diff options
Diffstat (limited to 'drivers/s390/char/monwriter.c')
-rw-r--r-- | drivers/s390/char/monwriter.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/s390/char/monwriter.c b/drivers/s390/char/monwriter.c index abd02ed501cb..b9b0fc3f812b 100644 --- a/drivers/s390/char/monwriter.c +++ b/drivers/s390/char/monwriter.c | |||
@@ -73,12 +73,15 @@ static inline struct mon_buf *monwrite_find_hdr(struct mon_private *monpriv, | |||
73 | struct mon_buf *entry, *next; | 73 | struct mon_buf *entry, *next; |
74 | 74 | ||
75 | list_for_each_entry_safe(entry, next, &monpriv->list, list) | 75 | list_for_each_entry_safe(entry, next, &monpriv->list, list) |
76 | if (entry->hdr.applid == monhdr->applid && | 76 | if ((entry->hdr.mon_function == monhdr->mon_function || |
77 | monhdr->mon_function == MONWRITE_STOP_INTERVAL) && | ||
78 | entry->hdr.applid == monhdr->applid && | ||
77 | entry->hdr.record_num == monhdr->record_num && | 79 | entry->hdr.record_num == monhdr->record_num && |
78 | entry->hdr.version == monhdr->version && | 80 | entry->hdr.version == monhdr->version && |
79 | entry->hdr.release == monhdr->release && | 81 | entry->hdr.release == monhdr->release && |
80 | entry->hdr.mod_level == monhdr->mod_level) | 82 | entry->hdr.mod_level == monhdr->mod_level) |
81 | return entry; | 83 | return entry; |
84 | |||
82 | return NULL; | 85 | return NULL; |
83 | } | 86 | } |
84 | 87 | ||
@@ -92,7 +95,9 @@ static int monwrite_new_hdr(struct mon_private *monpriv) | |||
92 | monhdr->mon_function > MONWRITE_START_CONFIG || | 95 | monhdr->mon_function > MONWRITE_START_CONFIG || |
93 | monhdr->hdrlen != sizeof(struct monwrite_hdr)) | 96 | monhdr->hdrlen != sizeof(struct monwrite_hdr)) |
94 | return -EINVAL; | 97 | return -EINVAL; |
95 | monbuf = monwrite_find_hdr(monpriv, monhdr); | 98 | monbuf = NULL; |
99 | if (monhdr->mon_function != MONWRITE_GEN_EVENT) | ||
100 | monbuf = monwrite_find_hdr(monpriv, monhdr); | ||
96 | if (monbuf) { | 101 | if (monbuf) { |
97 | if (monhdr->mon_function == MONWRITE_STOP_INTERVAL) { | 102 | if (monhdr->mon_function == MONWRITE_STOP_INTERVAL) { |
98 | monhdr->datalen = monbuf->hdr.datalen; | 103 | monhdr->datalen = monbuf->hdr.datalen; |
@@ -104,7 +109,7 @@ static int monwrite_new_hdr(struct mon_private *monpriv) | |||
104 | kfree(monbuf); | 109 | kfree(monbuf); |
105 | monbuf = NULL; | 110 | monbuf = NULL; |
106 | } | 111 | } |
107 | } else { | 112 | } else if (monhdr->mon_function != MONWRITE_STOP_INTERVAL) { |
108 | if (mon_buf_count >= mon_max_bufs) | 113 | if (mon_buf_count >= mon_max_bufs) |
109 | return -ENOSPC; | 114 | return -ENOSPC; |
110 | monbuf = kzalloc(sizeof(struct mon_buf), GFP_KERNEL); | 115 | monbuf = kzalloc(sizeof(struct mon_buf), GFP_KERNEL); |
@@ -118,7 +123,8 @@ static int monwrite_new_hdr(struct mon_private *monpriv) | |||
118 | } | 123 | } |
119 | monbuf->hdr = *monhdr; | 124 | monbuf->hdr = *monhdr; |
120 | list_add_tail(&monbuf->list, &monpriv->list); | 125 | list_add_tail(&monbuf->list, &monpriv->list); |
121 | mon_buf_count++; | 126 | if (monhdr->mon_function != MONWRITE_GEN_EVENT) |
127 | mon_buf_count++; | ||
122 | } | 128 | } |
123 | monpriv->current_buf = monbuf; | 129 | monpriv->current_buf = monbuf; |
124 | return 0; | 130 | return 0; |