aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-09-29 16:51:45 +0200
committerKevin Wolf <kwolf@redhat.com>2023-10-12 16:31:33 +0200
commitb7cfc7d58ec697a681a269036dc8f6444ffd495d (patch)
tree7de8cd2b44868526b1b7415d3cf88ee810b98ab9 /qemu-img.c
parent15f3f1fe57cd98ef0f45a25681b7a99dc3be0484 (diff)
block: Mark bdrv_refresh_filename() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_refresh_filename() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20230929145157.45443-11-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 5a74e9b10e..3ecbc375b0 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3165,7 +3165,9 @@ static int get_block_status(BlockDriverState *bs, int64_t offset,
has_offset = !!(ret & BDRV_BLOCK_OFFSET_VALID);
if (file && has_offset) {
+ bdrv_graph_rdlock_main_loop();
bdrv_refresh_filename(file);
+ bdrv_graph_rdunlock_main_loop();
filename = file->filename;
}
@@ -3688,7 +3690,9 @@ static int img_rebase(int argc, char **argv)
qdict_put_bool(options, BDRV_OPT_FORCE_SHARE, true);
}
+ bdrv_graph_rdlock_main_loop();
bdrv_refresh_filename(bs);
+ bdrv_graph_rdunlock_main_loop();
overlay_filename = bs->exact_filename[0] ? bs->exact_filename
: bs->filename;
out_real_path =