aboutsummaryrefslogtreecommitdiff
path: root/include/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-10-27 17:53:10 +0200
committerKevin Wolf <kwolf@redhat.com>2023-11-07 19:14:19 +0100
commit221caadcc5129d3ec5ad9ecfd7374de0f7050316 (patch)
tree8ea708d1d163ca44332f056fd9e19ed3a71fabbd /include/block
parent462ad017ed76889d46696a3581e1b52343f9b683 (diff)
block: Mark bdrv_probe_blocksizes() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_probe_blocksizes() need to hold a reader lock for the graph because it calls bdrv_filter_bs(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20231027155333.420094-2-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/block')
-rw-r--r--include/block/block-global-state.h2
-rw-r--r--include/block/block_int-common.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/include/block/block-global-state.h b/include/block/block-global-state.h
index 6bfafe781d..fca0a40dbd 100644
--- a/include/block/block-global-state.h
+++ b/include/block/block-global-state.h
@@ -281,7 +281,7 @@ bool bdrv_child_change_aio_context(BdrvChild *c, AioContext *ctx,
int bdrv_try_change_aio_context(BlockDriverState *bs, AioContext *ctx,
BdrvChild *ignore_child, Error **errp);
-int bdrv_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz);
+int GRAPH_RDLOCK bdrv_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz);
int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry *geo);
void GRAPH_WRLOCK
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index b8d9d24f39..8abdd2724b 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -386,7 +386,8 @@ struct BlockDriver {
* On success, store them in @bsz and return zero.
* On failure, return negative errno.
*/
- int (*bdrv_probe_blocksizes)(BlockDriverState *bs, BlockSizes *bsz);
+ int GRAPH_RDLOCK_PTR (*bdrv_probe_blocksizes)(
+ BlockDriverState *bs, BlockSizes *bsz);
/**
* Try to get @bs's geometry (cyls, heads, sectors)
* On success, store them in @geo and return 0.