[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 17/20] block: Mark bdrv_query_bds_stats() and callers GRAPH_RD
From: |
Kevin Wolf |
Subject: |
[PATCH v2 17/20] block: Mark bdrv_query_bds_stats() and callers GRAPH_RDLOCK |
Date: |
Thu, 4 May 2023 13:57:47 +0200 |
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>
---
block/qapi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/qapi.c b/block/qapi.c
index c84147849d..71f2751257 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)) {
--
2.40.1
- [PATCH v2 16/20] block: Mark BlockDriver callbacks for amend job GRAPH_RDLOCK, (continued)
- [PATCH v2 16/20] block: Mark BlockDriver callbacks for amend job GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 15/20] block: Mark bdrv_co_debug_event() GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 07/20] graph-lock: Fix GRAPH_RDLOCK_GUARD*() to be reader lock, Kevin Wolf, 2023/05/04
- [PATCH v2 12/20] mirror: Require GRAPH_RDLOCK for accessing a node's parent list, Kevin Wolf, 2023/05/04
- [PATCH v2 13/20] block: Mark bdrv_co_get_allocated_file_size() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 20/20] block: Mark bdrv_refresh_limits() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 08/20] block: .bdrv_open is non-coroutine and unlocked, Kevin Wolf, 2023/05/04
- [PATCH v2 10/20] nbd: Mark nbd_co_do_establish_connection() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 17/20] block: Mark bdrv_query_bds_stats() and callers GRAPH_RDLOCK,
Kevin Wolf <=
- [PATCH v2 18/20] block: Mark bdrv_query_block_graph_info() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 19/20] block: Mark bdrv_recurse_can_replace() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- Re: [PATCH v2 00/20] Graph locking, part 3 (more block drivers), Kevin Wolf, 2023/05/09
- Re: [PATCH v2 00/20] Graph locking, part 3 (more block drivers), Stefan Hajnoczi, 2023/05/09