aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-12-08 13:43:52 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2023-12-14 10:11:59 +0300
commitb8311827286a08743a0257372b75fe98c0b8a67b (patch)
tree04dc126877ccd3d84348e63db1ad91047b8b0198
parentfab36df7bdc81656ff48f718a795e08257b49a9e (diff)
block: Fix AioContext locking in qmp_block_resize()
The AioContext must be unlocked before calling blk_co_unref(), because it takes the AioContext lock internally in blk_unref_bh(), which is scheduled in the main thread. If we don't unlock, the AioContext is locked twice and nested event loops such as in bdrv_graph_wrlock() will deadlock. Cc: <qemu-stable@nongnu.org> Fixes: https://issues.redhat.com/browse/RHEL-15965 Fixes: 0c7d204f50c382c6baac8c94bd57af4a022b3888 Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20231208124352.30295-1-kwolf@redhat.com> (cherry picked from commit 755ae3811fec77d94e92398632cbfe23c4ecffd5) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--blockdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c
index e6eba61484..c28462a633 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2361,8 +2361,9 @@ void coroutine_fn qmp_block_resize(const char *device, const char *node_name,
bdrv_co_lock(bs);
bdrv_drained_end(bs);
- blk_co_unref(blk);
bdrv_co_unlock(bs);
+
+ blk_co_unref(blk);
}
void qmp_block_stream(const char *job_id, const char *device,