aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-05-04 13:57:47 +0200
committerKevin Wolf <kwolf@redhat.com>2023-05-10 14:16:54 +0200
commit6ec75a6a3ed9d6ff3161d1f97c497909906495bd (patch)
treeff7f5cf2b54197a81c4d13402134e57a8be7b08a /block
parent840428a2669c90f75cf0d26a06bdfe6f51755fae (diff)
downloadqemu-6ec75a6a3ed9d6ff3161d1f97c497909906495bd.zip
qemu-6ec75a6a3ed9d6ff3161d1f97c497909906495bd.tar.gz
qemu-6ec75a6a3ed9d6ff3161d1f97c497909906495bd.tar.bz2
block: Mark bdrv_query_bds_stats() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_query_bds_stats() 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> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20230504115750.54437-18-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qapi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block/qapi.c b/block/qapi.c
index c841478..71f2751 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -604,8 +604,8 @@ static void bdrv_query_blk_stats(BlockDeviceStats *ds, BlockBackend *blk)
= bdrv_latency_histogram_stats(&hgram[BLOCK_ACCT_FLUSH]);
}
-static BlockStats *bdrv_query_bds_stats(BlockDriverState *bs,
- bool blk_level)
+static BlockStats * GRAPH_RDLOCK
+bdrv_query_bds_stats(BlockDriverState *bs, bool blk_level)
{
BdrvChild *parent_child;
BlockDriverState *filter_or_cow_bs;
@@ -713,6 +713,8 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
BlockBackend *blk;
BlockDriverState *bs;
+ GRAPH_RDLOCK_GUARD_MAINLOOP();
+
/* Just to be safe if query_nodes is not always initialized */
if (has_query_nodes && query_nodes) {
for (bs = bdrv_next_node(NULL); bs; bs = bdrv_next_node(bs)) {