Skip to content

Commit

Permalink
block/io: Check for replay-enabled in bdrv_drain_all_begin()
Browse files Browse the repository at this point in the history
In commit da0bd74 we refactored bdrv_drain_all_begin() to pull out
the non-polling part into bdrv_drain_all_begin_nopoll().  This change
broke record-and-replay, because the "return early if replay enabled"
check is now in the sub-function bdrv_drain_all_begin_nopoll(), and
so it only causes us to return from that function, and not from the
calling bdrv_drain_all_begin().

Fix the regression by checking whether replay is enabled in both
functions.

The breakage and fix can be tested via 'make check-avocado': the
tests/avocado/reverse_debugging.py:ReverseDebugging_X86_64.test_x86_64_pc
tests/avocado/reverse_debugging.py:ReverseDebugging_AArch64.test_aarch64_virt
tests were both broken by this.

Fixes: da0bd74 ("block: Factor out bdrv_drain_all_begin_nopoll()")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Fabiano Rosas <farosas@suse.de>
Message-id: 20221220174638.2156308-1-peter.maydell@linaro.org
  • Loading branch information
pm215 committed Dec 21, 2022
1 parent 67de3d0 commit 6394578
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions block/io.c
Expand Up @@ -506,6 +506,15 @@ void bdrv_drain_all_begin(void)
return;
}

/*
* bdrv queue is managed by record/replay,
* waiting for finishing the I/O requests may
* be infinite
*/
if (replay_events_enabled()) {
return;
}

bdrv_drain_all_begin_nopoll();

/* Now poll the in-flight requests */
Expand Down

0 comments on commit 6394578

Please sign in to comment.