From: Kevin Wolf Date: Fri, 8 Feb 2019 15:51:17 +0000 (+0100) Subject: block: Fix AioContext switch for drained node X-Git-Tag: v4.0.0-rc0~78^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e64f25f30b8;p=thirdparty%2Fqemu.git block: Fix AioContext switch for drained node When a drained node changes its AioContext, we need to move its aio_disable_external() to the new context, too. Without this fix, drain_end will try to reenable the new context, which has never been disabled, so an assertion failure is triggered. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- diff --git a/block.c b/block.c index 17bc1d3dca3..aefb5701f55 100644 --- a/block.c +++ b/block.c @@ -5227,6 +5227,9 @@ void bdrv_detach_aio_context(BlockDriverState *bs) bdrv_detach_aio_context(child->bs); } + if (bs->quiesce_counter) { + aio_enable_external(bs->aio_context); + } bs->aio_context = NULL; } @@ -5240,6 +5243,10 @@ void bdrv_attach_aio_context(BlockDriverState *bs, return; } + if (bs->quiesce_counter) { + aio_disable_external(new_context); + } + bs->aio_context = new_context; QLIST_FOREACH(child, &bs->children, next) {