diff options
author | Kevin Wolf <kwolf@redhat.com> | 2023-09-29 16:51:39 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-10-12 16:31:33 +0200 |
commit | 2b3912f1350971fbc2c04d986a1d0c60ae757c78 (patch) | |
tree | 968e32867ca0d1a1c3579adb014e07595d4ba1aa /block/export | |
parent | 0e6bad1f2171385ec3ab7b9721dacfdb7dda70d7 (diff) | |
download | qemu-2b3912f1350971fbc2c04d986a1d0c60ae757c78.zip qemu-2b3912f1350971fbc2c04d986a1d0c60ae757c78.tar.gz qemu-2b3912f1350971fbc2c04d986a1d0c60ae757c78.tar.bz2 |
block: Mark bdrv_first_blk() and bdrv_is_root_node() GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_first_blk() and bdrv_is_root_node() need to hold a reader lock
for the graph. These functions are the only functions in block-backend.c
that access the parent list of a node.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230929145157.45443-5-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/export')
-rw-r--r-- | block/export/export.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/block/export/export.c b/block/export/export.c index 10316b4..a8f274e 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -83,6 +83,8 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp) uint64_t perm; int ret; + GLOBAL_STATE_CODE(); + if (!id_wellformed(export->id)) { error_setg(errp, "Invalid block export id"); return NULL; @@ -145,7 +147,9 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp) * access since the export could be available before migration handover. * ctx was acquired in the caller. */ + bdrv_graph_rdlock_main_loop(); bdrv_activate(bs, NULL); + bdrv_graph_rdunlock_main_loop(); perm = BLK_PERM_CONSISTENT_READ; if (export->writable) { |