[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 09/19] block: Nested drain_end must still call callb
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH 09/19] block: Nested drain_end must still call callbacks |
Date: |
Wed, 20 Dec 2017 11:34:02 +0100 |
bdrv_do_drained_begin() restricts the call of parent callbacks and
aio_disable_external() to the outermost drain section, but the block
driver callbacks are always called. bdrv_do_drained_end() must match
this behaviour, otherwise nodes stay drained even if begin/end calls
were balanced.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/io.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/block/io.c b/block/io.c
index 74d2e5278e..6038a16c58 100644
--- a/block/io.c
+++ b/block/io.c
@@ -273,19 +273,21 @@ void bdrv_drained_begin(BlockDriverState *bs)
void bdrv_drained_end(BlockDriverState *bs)
{
+ int old_quiesce_counter;
+
if (qemu_in_coroutine()) {
bdrv_co_yield_to_drain(bs, false);
return;
}
assert(bs->quiesce_counter > 0);
- if (atomic_fetch_dec(&bs->quiesce_counter) > 1) {
- return;
- }
+ old_quiesce_counter = atomic_fetch_dec(&bs->quiesce_counter);
/* Re-enable things in child-to-parent order */
bdrv_drain_invoke(bs, false, false);
- bdrv_parent_drained_end(bs);
- aio_enable_external(bdrv_get_aio_context(bs));
+ if (old_quiesce_counter == 1) {
+ bdrv_parent_drained_end(bs);
+ aio_enable_external(bdrv_get_aio_context(bs));
+ }
}
/*
--
2.13.6
- [Qemu-block] [PATCH 03/19] block: Make bdrv_drain() driver callbacks non-recursive, (continued)
- [Qemu-block] [PATCH 04/19] test-bdrv-drain: Test callback for bdrv_drain, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 05/19] test-bdrv-drain: Test bs->quiesce_counter, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 07/19] test-bdrv-drain: Test drain vs. block jobs, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 08/19] block: Don't block_job_pause_all() in bdrv_drain_all(), Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 06/19] blockjob: Pause job on draining any job BDS, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 09/19] block: Nested drain_end must still call callbacks,
Kevin Wolf <=
- [Qemu-block] [PATCH 11/19] block: Don't notify parents in drain call chain, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 10/19] test-bdrv-drain: Test nested drain sections, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 12/19] block: Add bdrv_subtree_drained_begin/end(), Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 14/19] test-bdrv-drain: Test behaviour in coroutine context, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 15/19] test-bdrv-drain: Recursive draining with multiple parents, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 13/19] test-bdrv-drain: Tests for bdrv_subtree_drain, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 17/19] test-bdrv-drain: Test graph changes in drained section, Kevin Wolf, 2017/12/20
- [Qemu-block] [PATCH 16/19] block: Allow graph changes in subtree drained section, Kevin Wolf, 2017/12/20