[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/26] block: Mark bdrv_get_xdbg_block_graph() and callers GRAPH_R
From: |
Kevin Wolf |
Subject: |
[PULL 13/26] block: Mark bdrv_get_xdbg_block_graph() and callers GRAPH_RDLOCK |
Date: |
Thu, 12 Oct 2023 18:22:11 +0200 |
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_get_xdbg_block_graph() 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-10-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block-global-state.h | 2 +-
blockdev.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/block/block-global-state.h
b/include/block/block-global-state.h
index 505a0d0c11..4d80b3d554 100644
--- a/include/block/block-global-state.h
+++ b/include/block/block-global-state.h
@@ -192,7 +192,7 @@ int bdrv_has_zero_init_1(BlockDriverState *bs);
int bdrv_has_zero_init(BlockDriverState *bs);
BlockDriverState *bdrv_find_node(const char *node_name);
BlockDeviceInfoList *bdrv_named_nodes_list(bool flat, Error **errp);
-XDbgBlockGraph *bdrv_get_xdbg_block_graph(Error **errp);
+XDbgBlockGraph * GRAPH_RDLOCK bdrv_get_xdbg_block_graph(Error **errp);
BlockDriverState *bdrv_lookup_bs(const char *device,
const char *node_name,
Error **errp);
diff --git a/blockdev.c b/blockdev.c
index 43e0c4ddf2..ff5ee9ff7b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2846,6 +2846,8 @@ BlockDeviceInfoList *qmp_query_named_block_nodes(bool
has_flat,
XDbgBlockGraph *qmp_x_debug_query_block_graph(Error **errp)
{
+ GRAPH_RDLOCK_GUARD_MAINLOOP();
+
return bdrv_get_xdbg_block_graph(errp);
}
--
2.41.0
- [PULL 00/26] Block layer patches, Kevin Wolf, 2023/10/12
- [PULL 06/26] block-coroutine-wrapper: Add no_co_wrapper_bdrv_rdlock functions, Kevin Wolf, 2023/10/12
- [PULL 14/26] block: Mark bdrv_refresh_filename() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 07/26] block: Take graph rdlock in bdrv_inactivate_all(), Kevin Wolf, 2023/10/12
- [PULL 17/26] block: Mark bdrv_amend_options() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 03/26] block: switch to co_wrapper for bdrv_is_allocated_*, Kevin Wolf, 2023/10/12
- [PULL 11/26] block: Mark bdrv_snapshot_fallback() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 02/26] block: complete public block status API, Kevin Wolf, 2023/10/12
- [PULL 09/26] block: Mark drain related functions GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 05/26] test-bdrv-drain: Don't call bdrv_graph_wrlock() in coroutine context, Kevin Wolf, 2023/10/12
- [PULL 13/26] block: Mark bdrv_get_xdbg_block_graph() and callers GRAPH_RDLOCK,
Kevin Wolf <=
- [PULL 19/26] qcow2: Mark qcow2_inactivate() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 12/26] block: Take graph rdlock in parts of reopen, Kevin Wolf, 2023/10/12
- [PULL 10/26] block: Mark bdrv_parent_cb_resize() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 01/26] block: rename the bdrv_co_block_status static function, Kevin Wolf, 2023/10/12
- [PULL 18/26] qcow2: Mark qcow2_signal_corruption() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 04/26] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions, Kevin Wolf, 2023/10/12
- [PULL 22/26] block: Mark bdrv_apply_auto_read_only() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 24/26] block: Protect bs->parents with graph_lock, Kevin Wolf, 2023/10/12
- [PULL 16/26] block: Mark bdrv_get_parent_name() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/10/12
- [PULL 25/26] block: Protect bs->children with graph_lock, Kevin Wolf, 2023/10/12