Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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: 0c7d204
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20231208124352.30295-1-kwolf@redhat.com>
  • Loading branch information
Kevin Wolf authored and Stefan Hajnoczi committed Dec 12, 2023
1 parent eaae59a commit 755ae38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion blockdev.c
Expand Up @@ -2400,8 +2400,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,
Expand Down

0 comments on commit 755ae38

Please sign in to comment.