Skip to content

Commit

Permalink
block: Mark bdrv_get_xdbg_block_graph() and callers GRAPH_RDLOCK
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kevmw committed Oct 12, 2023
1 parent ce433d2 commit 15f3f1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions blockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion include/block/block-global-state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 15f3f1f

Please sign in to comment.