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>
This commit is contained in:
+6
-5
@@ -225,9 +225,8 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs,
|
||||
* Helper function for other query info functions. Store information about @bs
|
||||
* in @info, setting @errp on error.
|
||||
*/
|
||||
static void bdrv_do_query_node_info(BlockDriverState *bs,
|
||||
BlockNodeInfo *info,
|
||||
Error **errp)
|
||||
static void GRAPH_RDLOCK
|
||||
bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
|
||||
{
|
||||
int64_t size;
|
||||
const char *backing_filename;
|
||||
@@ -423,8 +422,8 @@ fail:
|
||||
}
|
||||
|
||||
/* @p_info will be set only on success. */
|
||||
static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info,
|
||||
Error **errp)
|
||||
static void GRAPH_RDLOCK
|
||||
bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, Error **errp)
|
||||
{
|
||||
BlockInfo *info = g_malloc0(sizeof(*info));
|
||||
BlockDriverState *bs = blk_bs(blk);
|
||||
@@ -672,6 +671,8 @@ BlockInfoList *qmp_query_block(Error **errp)
|
||||
BlockBackend *blk;
|
||||
Error *local_err = NULL;
|
||||
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
|
||||
BlockInfoList *info;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user