qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] blkdebug: fix "once" rule
@ 2015-02-06 21:26 John Snow
  2015-02-06 21:29 ` Max Reitz
  2015-02-16 19:33 ` Max Reitz
  0 siblings, 2 replies; 3+ messages in thread
From: John Snow @ 2015-02-06 21:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, John Snow, mreitz

Background:
  The blkdebug scripts are currently engineered so that when a debug
event occurs, a prefilter browses a master list of parsed rules for a
certain event and adds them to an "active list" of rules to be used for
the forthcoming action, provided the events and state numbers match.

  Then, once the request is received, the last active rule is used to
inject an error if certain parameters match.

  This active list is cleared every time the prefilter injects a new
rule for the first time during a debug event.

  The "once" rule currently causes the error injection, if it is
triggered, to only clear the active list. This is insufficient for
preventing future injections of the same rule.

Remedy:
  This patch /deletes/ the rule from the list that the prefilter
browses, so it is gone for good. In V2, we remove only the rule of
interest from the active list instead of allowing the "once" rule to
clear the entire list of active rules.

Impact:
  This affects iotests 026. Several ENOSPC tests that used "once" can
be seen to have output that shows multiple failure messages. After
this patch, the error messages tend to be smaller and less severe, but
the injection can still be seen to be working. I have patched the
expected output to expect the smaller error messages.

Signed-off-by: John Snow <jsnow@redhat.com>
---

V3:
  - Fix interaction of "immediately" and "once" rule
  - Remembered that my patch sending script does not work well with
    single patches and moved the version history below the commit bump

V2:
  - Remove only the offending "once" rule from the active list instead
    of clearing the entire active list.

 block/blkdebug.c           |  6 ++++--
 tests/qemu-iotests/026.out | 24 ++++--------------------
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/block/blkdebug.c b/block/blkdebug.c
index 9ce35cd..63611e0 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -472,12 +472,14 @@ static BlockAIOCB *inject_error(BlockDriverState *bs,
     int error = rule->options.inject.error;
     struct BlkdebugAIOCB *acb;
     QEMUBH *bh;
+    bool immediately = rule->options.inject.immediately;
 
     if (rule->options.inject.once) {
-        QSIMPLEQ_INIT(&s->active_rules);
+        QSIMPLEQ_REMOVE(&s->active_rules, rule, BlkdebugRule, active_next);
+        remove_rule(rule);
     }
 
-    if (rule->options.inject.immediately) {
+    if (immediately) {
         return NULL;
     }
 
diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out
index 524f7ee..5e964fb 100644
--- a/tests/qemu-iotests/026.out
+++ b/tests/qemu-iotests/026.out
@@ -140,19 +140,13 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: l2_update; errno: 5; imm: off; once: on; write
-Failed to flush the L2 table cache: Input/output error
 write failed: Input/output error
-
-127 leaked clusters were found on the image.
-This means waste of disk space, but no harm to data.
+No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: l2_update; errno: 5; imm: off; once: on; write -b
-Failed to flush the L2 table cache: Input/output error
 write failed: Input/output error
-
-127 leaked clusters were found on the image.
-This means waste of disk space, but no harm to data.
+No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: l2_update; errno: 5; imm: off; once: off; write
@@ -174,19 +168,13 @@ This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: l2_update; errno: 28; imm: off; once: on; write
-Failed to flush the L2 table cache: No space left on device
 write failed: No space left on device
-
-127 leaked clusters were found on the image.
-This means waste of disk space, but no harm to data.
+No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: l2_update; errno: 28; imm: off; once: on; write -b
-Failed to flush the L2 table cache: No space left on device
 write failed: No space left on device
-
-127 leaked clusters were found on the image.
-This means waste of disk space, but no harm to data.
+No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: l2_update; errno: 28; imm: off; once: off; write
@@ -356,13 +344,11 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: refblock_update_part; errno: 5; imm: off; once: on; write
-Failed to flush the refcount block cache: Input/output error
 write failed: Input/output error
 No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: refblock_update_part; errno: 5; imm: off; once: on; write -b
-Failed to flush the refcount block cache: Input/output error
 write failed: Input/output error
 No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
@@ -382,13 +368,11 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: refblock_update_part; errno: 28; imm: off; once: on; write
-Failed to flush the refcount block cache: No space left on device
 write failed: No space left on device
 No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: refblock_update_part; errno: 28; imm: off; once: on; write -b
-Failed to flush the refcount block cache: No space left on device
 write failed: No space left on device
 No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v3] blkdebug: fix "once" rule
  2015-02-06 21:26 [Qemu-devel] [PATCH v3] blkdebug: fix "once" rule John Snow
@ 2015-02-06 21:29 ` Max Reitz
  2015-02-16 19:33 ` Max Reitz
  1 sibling, 0 replies; 3+ messages in thread
From: Max Reitz @ 2015-02-06 21:29 UTC (permalink / raw)
  To: John Snow, qemu-devel; +Cc: kwolf, pbonzini

On 2015-02-06 at 16:26, John Snow wrote:
> Background:
>    The blkdebug scripts are currently engineered so that when a debug
> event occurs, a prefilter browses a master list of parsed rules for a
> certain event and adds them to an "active list" of rules to be used for
> the forthcoming action, provided the events and state numbers match.
>
>    Then, once the request is received, the last active rule is used to
> inject an error if certain parameters match.
>
>    This active list is cleared every time the prefilter injects a new
> rule for the first time during a debug event.
>
>    The "once" rule currently causes the error injection, if it is
> triggered, to only clear the active list. This is insufficient for
> preventing future injections of the same rule.
>
> Remedy:
>    This patch /deletes/ the rule from the list that the prefilter
> browses, so it is gone for good. In V2, we remove only the rule of
> interest from the active list instead of allowing the "once" rule to
> clear the entire list of active rules.
>
> Impact:
>    This affects iotests 026. Several ENOSPC tests that used "once" can
> be seen to have output that shows multiple failure messages. After
> this patch, the error messages tend to be smaller and less severe, but
> the injection can still be seen to be working. I have patched the
> expected output to expect the smaller error messages.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>
> V3:
>    - Fix interaction of "immediately" and "once" rule
>    - Remembered that my patch sending script does not work well with
>      single patches and moved the version history below the commit bump
>
> V2:
>    - Remove only the offending "once" rule from the active list instead
>      of clearing the entire active list.
>
>   block/blkdebug.c           |  6 ++++--
>   tests/qemu-iotests/026.out | 24 ++++--------------------
>   2 files changed, 8 insertions(+), 22 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v3] blkdebug: fix "once" rule
  2015-02-06 21:26 [Qemu-devel] [PATCH v3] blkdebug: fix "once" rule John Snow
  2015-02-06 21:29 ` Max Reitz
@ 2015-02-16 19:33 ` Max Reitz
  1 sibling, 0 replies; 3+ messages in thread
From: Max Reitz @ 2015-02-16 19:33 UTC (permalink / raw)
  To: John Snow, qemu-devel; +Cc: kwolf, pbonzini

On 2015-02-06 at 16:26, John Snow wrote:
> Background:
>    The blkdebug scripts are currently engineered so that when a debug
> event occurs, a prefilter browses a master list of parsed rules for a
> certain event and adds them to an "active list" of rules to be used for
> the forthcoming action, provided the events and state numbers match.
>
>    Then, once the request is received, the last active rule is used to
> inject an error if certain parameters match.
>
>    This active list is cleared every time the prefilter injects a new
> rule for the first time during a debug event.
>
>    The "once" rule currently causes the error injection, if it is
> triggered, to only clear the active list. This is insufficient for
> preventing future injections of the same rule.
>
> Remedy:
>    This patch /deletes/ the rule from the list that the prefilter
> browses, so it is gone for good. In V2, we remove only the rule of
> interest from the active list instead of allowing the "once" rule to
> clear the entire list of active rules.
>
> Impact:
>    This affects iotests 026. Several ENOSPC tests that used "once" can
> be seen to have output that shows multiple failure messages. After
> this patch, the error messages tend to be smaller and less severe, but
> the injection can still be seen to be working. I have patched the
> expected output to expect the smaller error messages.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>
> V3:
>    - Fix interaction of "immediately" and "once" rule
>    - Remembered that my patch sending script does not work well with
>      single patches and moved the version history below the commit bump
>
> V2:
>    - Remove only the offending "once" rule from the active list instead
>      of clearing the entire active list.
>
>   block/blkdebug.c           |  6 ++++--
>   tests/qemu-iotests/026.out | 24 ++++--------------------
>   2 files changed, 8 insertions(+), 22 deletions(-)

Thanks, applied to my block tree:

https://github.com/XanClic/qemu/commits/block

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-16 19:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06 21:26 [Qemu-devel] [PATCH v3] blkdebug: fix "once" rule John Snow
2015-02-06 21:29 ` Max Reitz
2015-02-16 19:33 ` Max Reitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).