]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block: mark bdrv_close() as GRAPH_UNLOCKED
authorFiona Ebner <f.ebner@proxmox.com>
Fri, 30 May 2025 15:11:23 +0000 (17:11 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 14 Jul 2025 13:42:26 +0000 (15:42 +0200)
The functions blk_log_writes_close(), blkverify_close(),
quorum_close(), vmdk_close() via vmdk_free_extents(), and other
bdrv_close() implementations call bdrv_graph_wrlock_drained(), which
must be called with the graph unlocked. They are reached via the
BlockDriver's bdrv_close() callback and the bdrv_close() wrapper,
which are also marked as GRAPH_UNLOCKED_PTR and GRAPH_UNLOCKED.

Furthermore, the function bdrv_close() also calls bdrv_drained_begin()
and bdrv_graph_wrlock_drained(), so there are additional reasons for
marking it GRAPH_UNLOCKED.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Message-ID: <20250530151125.955508-47-f.ebner@proxmox.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
include/block/block_int-common.h

diff --git a/block.c b/block.c
index fe5aa2e7676fb99c4779ee3f6cbc19e652fc4353..8d3dd5a8e3bb2f9160502ee6f0c0f16be480278e 100644 (file)
--- a/block.c
+++ b/block.c
@@ -5146,7 +5146,7 @@ static void GRAPH_UNLOCKED bdrv_reopen_abort(BDRVReopenState *reopen_state)
 }
 
 
-static void bdrv_close(BlockDriverState *bs)
+static void GRAPH_UNLOCKED bdrv_close(BlockDriverState *bs)
 {
     BdrvAioNotifier *ban, *ban_next;
     BdrvChild *child, *next;
index e96c6a6a03e000275fbcfa618bd908b936711c12..034c0634c8d3dd6b4a86771136f118993e654f12 100644 (file)
@@ -248,7 +248,7 @@ struct BlockDriver {
     int GRAPH_UNLOCKED_PTR (*bdrv_open)(
         BlockDriverState *bs, QDict *options, int flags, Error **errp);
 
-    void (*bdrv_close)(BlockDriverState *bs);
+    void GRAPH_UNLOCKED_PTR (*bdrv_close)(BlockDriverState *bs);
 
     int coroutine_fn GRAPH_UNLOCKED_PTR (*bdrv_co_create)(
         BlockdevCreateOptions *opts, Error **errp);