summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf2020-03-10 12:38:29 +0100
committerKevin Wolf2020-03-11 15:54:38 +0100
commit30dd65f307b647eef8156c4a33bd007823ef85cb (patch)
tree57baa13b7fc6b892e8f9b5205ab5245e08491b7d /block.c
parentiotests: Test mirror with temporarily disabled target backing file (diff)
downloadqemu-30dd65f307b647eef8156c4a33bd007823ef85cb.tar.gz
qemu-30dd65f307b647eef8156c4a33bd007823ef85cb.tar.xz
qemu-30dd65f307b647eef8156c4a33bd007823ef85cb.zip
block: Fix cross-AioContext blockdev-snapshot
external_snapshot_prepare() tries to move the overlay to the AioContext of the backing file (the snapshotted node). However, it's possible that this doesn't work, but the backing file can instead be moved to the overlay's AioContext (e.g. opening the backing chain for a mirror target). bdrv_append() already indirectly uses bdrv_attach_node(), which takes care to move nodes to make sure they use the same AioContext and which tries both directions. So the problem has a simple fix: Just delete the unnecessary extra bdrv_try_set_aio_context() call in external_snapshot_prepare() and instead assert in bdrv_append() that both nodes were indeed moved to the same AioContext. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20200310113831.27293-6-kwolf@redhat.com> Tested-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block.c b/block.c
index 79a5a2770f..8fc7b56937 100644
--- a/block.c
+++ b/block.c
@@ -4365,6 +4365,7 @@ void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to,
bdrv_ref(from);
assert(qemu_get_current_aio_context() == qemu_get_aio_context());
+ assert(bdrv_get_aio_context(from) == bdrv_get_aio_context(to));
bdrv_drained_begin(from);
/* Put all parents into @list and calculate their cumulative permissions */