From 2626d27f50f3c993936db04bc6e92d553e1dc914 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 25 May 2023 14:47:06 +0200 Subject: mirror: Hold main AioContext lock for calling bdrv_open_backing_file() bdrv_open_backing_file() calls bdrv_open_inherit(), so all callers must hold the main AioContext lock. Signed-off-by: Kevin Wolf Message-Id: <20230525124713.401149-6-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/mirror.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'block/mirror.c') diff --git a/block/mirror.c b/block/mirror.c index b7d92d1378..d3cacd1708 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -662,11 +662,15 @@ static int mirror_exit_common(Job *job) bool abort = job->ret < 0; int ret = 0; + GLOBAL_STATE_CODE(); + if (s->prepared) { return 0; } s->prepared = true; + aio_context_acquire(qemu_get_aio_context()); + mirror_top_bs = s->mirror_top_bs; bs_opaque = mirror_top_bs->opaque; src = mirror_top_bs->backing->bs; @@ -789,6 +793,8 @@ static int mirror_exit_common(Job *job) bdrv_unref(mirror_top_bs); bdrv_unref(src); + aio_context_release(qemu_get_aio_context()); + return ret; } -- cgit v1.2.3