aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-05-04 13:57:49 +0200
committerKevin Wolf <kwolf@redhat.com>2023-05-10 14:16:54 +0200
commit533c6e4ee8885cb9e7c6ac36e8e9fa92bea64f97 (patch)
treed490bdbbc180f6ce60879f21404b9f075f4fe713 /include
parent4f0bef8b36eb33efbba0a216b233265d734bdbfb (diff)
downloadqemu-533c6e4ee8885cb9e7c6ac36e8e9fa92bea64f97.zip
qemu-533c6e4ee8885cb9e7c6ac36e8e9fa92bea64f97.tar.gz
qemu-533c6e4ee8885cb9e7c6ac36e8e9fa92bea64f97.tar.bz2
block: Mark bdrv_recurse_can_replace() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_recurse_can_replace() 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-20-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block-global-state.h5
-rw-r--r--include/block/block_int-common.h4
-rw-r--r--include/block/block_int-global-state.h4
3 files changed, 7 insertions, 6 deletions
diff --git a/include/block/block-global-state.h b/include/block/block-global-state.h
index ec3ddb1..f234bca 100644
--- a/include/block/block-global-state.h
+++ b/include/block/block-global-state.h
@@ -163,8 +163,9 @@ int bdrv_amend_options(BlockDriverState *bs_new, QemuOpts *opts,
Error **errp);
/* check if a named node can be replaced when doing drive-mirror */
-BlockDriverState *check_to_replace_node(BlockDriverState *parent_bs,
- const char *node_name, Error **errp);
+BlockDriverState * GRAPH_RDLOCK
+check_to_replace_node(BlockDriverState *parent_bs, const char *node_name,
+ Error **errp);
int no_coroutine_fn bdrv_activate(BlockDriverState *bs, Error **errp);
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index 37d0947..024ded4 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -217,8 +217,8 @@ struct BlockDriver {
* same data as @bs without it affecting @bs's behavior (that is,
* without it being visible to @bs's parents).
*/
- bool (*bdrv_recurse_can_replace)(BlockDriverState *bs,
- BlockDriverState *to_replace);
+ bool GRAPH_RDLOCK_PTR (*bdrv_recurse_can_replace)(
+ BlockDriverState *bs, BlockDriverState *to_replace);
int (*bdrv_probe_device)(const char *filename);
diff --git a/include/block/block_int-global-state.h b/include/block/block_int-global-state.h
index 902406e..da5fb31 100644
--- a/include/block/block_int-global-state.h
+++ b/include/block/block_int-global-state.h
@@ -225,8 +225,8 @@ int bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared,
*/
int bdrv_child_refresh_perms(BlockDriverState *bs, BdrvChild *c, Error **errp);
-bool bdrv_recurse_can_replace(BlockDriverState *bs,
- BlockDriverState *to_replace);
+bool GRAPH_RDLOCK bdrv_recurse_can_replace(BlockDriverState *bs,
+ BlockDriverState *to_replace);
/*
* Default implementation for BlockDriver.bdrv_child_perm() that can