Commit 2c91971f authored by Melissa Howland's avatar Melissa Howland Committed by Martin Schwidefsky

[S390] monwriter find header logic.

Fix logic for finding matching buffers.
Signed-off-by: default avatarMelissa Howland <melissah@us.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 85a4aa64
...@@ -73,12 +73,15 @@ static inline struct mon_buf *monwrite_find_hdr(struct mon_private *monpriv, ...@@ -73,12 +73,15 @@ static inline struct mon_buf *monwrite_find_hdr(struct mon_private *monpriv,
struct mon_buf *entry, *next; struct mon_buf *entry, *next;
list_for_each_entry_safe(entry, next, &monpriv->list, list) list_for_each_entry_safe(entry, next, &monpriv->list, list)
if (entry->hdr.applid == monhdr->applid && if ((entry->hdr.mon_function == monhdr->mon_function ||
monhdr->mon_function == MONWRITE_STOP_INTERVAL) &&
entry->hdr.applid == monhdr->applid &&
entry->hdr.record_num == monhdr->record_num && entry->hdr.record_num == monhdr->record_num &&
entry->hdr.version == monhdr->version && entry->hdr.version == monhdr->version &&
entry->hdr.release == monhdr->release && entry->hdr.release == monhdr->release &&
entry->hdr.mod_level == monhdr->mod_level) entry->hdr.mod_level == monhdr->mod_level)
return entry; return entry;
return NULL; return NULL;
} }
...@@ -92,6 +95,8 @@ static int monwrite_new_hdr(struct mon_private *monpriv) ...@@ -92,6 +95,8 @@ static int monwrite_new_hdr(struct mon_private *monpriv)
monhdr->mon_function > MONWRITE_START_CONFIG || monhdr->mon_function > MONWRITE_START_CONFIG ||
monhdr->hdrlen != sizeof(struct monwrite_hdr)) monhdr->hdrlen != sizeof(struct monwrite_hdr))
return -EINVAL; return -EINVAL;
monbuf = NULL;
if (monhdr->mon_function != MONWRITE_GEN_EVENT)
monbuf = monwrite_find_hdr(monpriv, monhdr); monbuf = monwrite_find_hdr(monpriv, monhdr);
if (monbuf) { if (monbuf) {
if (monhdr->mon_function == MONWRITE_STOP_INTERVAL) { if (monhdr->mon_function == MONWRITE_STOP_INTERVAL) {
...@@ -104,7 +109,7 @@ static int monwrite_new_hdr(struct mon_private *monpriv) ...@@ -104,7 +109,7 @@ static int monwrite_new_hdr(struct mon_private *monpriv)
kfree(monbuf); kfree(monbuf);
monbuf = NULL; monbuf = NULL;
} }
} else { } else if (monhdr->mon_function != MONWRITE_STOP_INTERVAL) {
if (mon_buf_count >= mon_max_bufs) if (mon_buf_count >= mon_max_bufs)
return -ENOSPC; return -ENOSPC;
monbuf = kzalloc(sizeof(struct mon_buf), GFP_KERNEL); monbuf = kzalloc(sizeof(struct mon_buf), GFP_KERNEL);
...@@ -118,6 +123,7 @@ static int monwrite_new_hdr(struct mon_private *monpriv) ...@@ -118,6 +123,7 @@ static int monwrite_new_hdr(struct mon_private *monpriv)
} }
monbuf->hdr = *monhdr; monbuf->hdr = *monhdr;
list_add_tail(&monbuf->list, &monpriv->list); list_add_tail(&monbuf->list, &monpriv->list);
if (monhdr->mon_function != MONWRITE_GEN_EVENT)
mon_buf_count++; mon_buf_count++;
} }
monpriv->current_buf = monbuf; monpriv->current_buf = monbuf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment