From e13550558840422f980a0a71efe52ee83f37933d Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 7 Dec 2022 14:18:30 +0100 Subject: block: Fix locking in external_snapshot_prepare() bdrv_img_create() polls internally (when calling bdrv_create(), which is a co_wrapper), so it can't be called while holding the lock of any AioContext except the current one without causing deadlocks. Drop the lock around the call in external_snapshot_prepare(). Signed-off-by: Kevin Wolf Message-Id: <20221207131838.239125-11-kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito Signed-off-by: Kevin Wolf --- blockdev.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index d2f80b0386..ebf952cd21 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1507,10 +1507,14 @@ static void external_snapshot_prepare(BlkActionState *common, goto out; } bdrv_refresh_filename(state->old_bs); + + aio_context_release(aio_context); bdrv_img_create(new_image_file, format, state->old_bs->filename, state->old_bs->drv->format_name, NULL, size, flags, false, &local_err); + aio_context_acquire(aio_context); + if (local_err) { error_propagate(errp, local_err); goto out; -- cgit v1.2.3