diff options
author | Fiona Ebner <f.ebner@proxmox.com> | 2025-05-30 17:11:11 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2025-07-14 15:42:05 +0200 |
commit | 6717dc307523c9e57b0d6c7dd302eab764c19265 (patch) | |
tree | c5861935a2a847d14b032bc5275a985e09eb1247 | |
parent | 0a0474b065b97e9a25c2723bde87afbc77ba4bd9 (diff) | |
download | qemu-6717dc307523c9e57b0d6c7dd302eab764c19265.zip qemu-6717dc307523c9e57b0d6c7dd302eab764c19265.tar.gz qemu-6717dc307523c9e57b0d6c7dd302eab764c19265.tar.bz2 |
block: mark bdrv_reopen_queue() and bdrv_reopen_multiple() as GRAPH_UNLOCKED
The function bdrv_reopen_queue() can call bdrv_drain_all_begin(),
which must be called with the graph unlocked.
The function bdrv_reopen_multiple() calls bdrv_reopen_prepare() which
must be called with the graph unlocked.
To mark bdrv_reopen_queue() as GRAPH_UNLOCKED, it is necessary to make
the locked section in reopen_backing_file() shorter.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Message-ID: <20250530151125.955508-35-f.ebner@proxmox.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | block/replication.c | 3 | ||||
-rw-r--r-- | include/block/block-global-state.h | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/block/replication.c b/block/replication.c index 83978b6..3a431e9 100644 --- a/block/replication.c +++ b/block/replication.c @@ -364,14 +364,15 @@ static void reopen_backing_file(BlockDriverState *bs, bool writable, BlockReopenQueue *reopen_queue = NULL; GLOBAL_STATE_CODE(); - GRAPH_RDLOCK_GUARD_MAINLOOP(); + bdrv_graph_rdlock_main_loop(); /* * s->hidden_disk and s->secondary_disk may not be set yet, as they will * only be set after the children are writable. */ hidden_disk = bs->file->bs->backing; secondary_disk = hidden_disk->bs->backing; + bdrv_graph_rdunlock_main_loop(); if (writable) { s->orig_hidden_read_only = bdrv_is_read_only(hidden_disk->bs); diff --git a/include/block/block-global-state.h b/include/block/block-global-state.h index bcbb624..f25c65c 100644 --- a/include/block/block-global-state.h +++ b/include/block/block-global-state.h @@ -121,11 +121,12 @@ BlockDriverState *bdrv_new_open_driver_opts(BlockDriver *drv, Error **errp); BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, int flags, Error **errp); -BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue, - BlockDriverState *bs, QDict *options, - bool keep_old_opts); +BlockReopenQueue * GRAPH_UNLOCKED +bdrv_reopen_queue(BlockReopenQueue *bs_queue, BlockDriverState *bs, + QDict *options, bool keep_old_opts); void bdrv_reopen_queue_free(BlockReopenQueue *bs_queue); -int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp); +int GRAPH_UNLOCKED +bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp); int bdrv_reopen(BlockDriverState *bs, QDict *opts, bool keep_old_opts, Error **errp); int bdrv_reopen_set_read_only(BlockDriverState *bs, bool read_only, |