From: Kevin Wolf Date: Fri, 27 Oct 2023 15:53:20 +0000 (+0200) Subject: block: Mark bdrv_filter_child() and callers GRAPH_RDLOCK X-Git-Tag: v8.2.0-rc0~14^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec82cc41a79ffa8b1a2dee76a420a34a59f117c6;p=thirdparty%2Fqemu.git block: Mark bdrv_filter_child() and callers GRAPH_RDLOCK This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_filter_child() need to hold a reader lock for the graph because it accesses bs->file/backing. Signed-off-by: Kevin Wolf Message-ID: <20231027155333.420094-12-kwolf@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- diff --git a/block.c b/block.c index bb322df7d86..499b147315b 100644 --- a/block.c +++ b/block.c @@ -8491,8 +8491,8 @@ BdrvChild *bdrv_primary_child(BlockDriverState *bs) return found; } -static BlockDriverState *bdrv_do_skip_filters(BlockDriverState *bs, - bool stop_on_explicit_filter) +static BlockDriverState * GRAPH_RDLOCK +bdrv_do_skip_filters(BlockDriverState *bs, bool stop_on_explicit_filter) { BdrvChild *c; diff --git a/include/block/block_int-io.h b/include/block/block_int-io.h index 4e7bf57a5e4..17547a2dab2 100644 --- a/include/block/block_int-io.h +++ b/include/block/block_int-io.h @@ -131,8 +131,8 @@ int co_wrapper_mixed_bdrv_rdlock bdrv_refresh_total_sectors(BlockDriverState *bs, int64_t hint); BdrvChild *bdrv_cow_child(BlockDriverState *bs); -BdrvChild *bdrv_filter_child(BlockDriverState *bs); -BdrvChild *bdrv_filter_or_cow_child(BlockDriverState *bs); +BdrvChild * GRAPH_RDLOCK bdrv_filter_child(BlockDriverState *bs); +BdrvChild * GRAPH_RDLOCK bdrv_filter_or_cow_child(BlockDriverState *bs); BdrvChild * GRAPH_RDLOCK bdrv_primary_child(BlockDriverState *bs); BlockDriverState * GRAPH_RDLOCK bdrv_skip_filters(BlockDriverState *bs); BlockDriverState * GRAPH_RDLOCK bdrv_backing_chain_next(BlockDriverState *bs);