On Fri, Oct 27, 2023 at 05:53:17PM +0200, Kevin Wolf wrote:
> This adds GRAPH_RDLOCK annotations to declare that callers of
> bdrv_skip_filters() need to hold a reader lock for the graph because it
> calls bdrv_filter_child(), which accesses bs->file/backing.
> 
> Signed-off-by: Kevin Wolf <kw...@redhat.com>
> ---
>  include/block/block-global-state.h |  8 ++++---
>  include/block/block_int-io.h       |  4 ++--
>  block/block-backend.c              |  1 +
>  block/block-copy.c                 |  9 +++++++-
>  block/commit.c                     |  5 ++++-
>  block/mirror.c                     | 34 +++++++++++++++++++++---------
>  block/stream.c                     | 22 ++++++++++++-------
>  blockdev.c                         |  7 +++---
>  qemu-img.c                         | 18 +++++++++++++---
>  9 files changed, 77 insertions(+), 31 deletions(-)
> 
> diff --git a/include/block/block-global-state.h 
> b/include/block/block-global-state.h
> index 3ae468ea15..b6860ae43b 100644
> --- a/include/block/block-global-state.h
> +++ b/include/block/block-global-state.h
> @@ -144,9 +144,11 @@ int bdrv_change_backing_file(BlockDriverState *bs, const 
> char *backing_file,
>  void bdrv_register(BlockDriver *bdrv);
>  int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base,
>                             const char *backing_file_str);
> -BlockDriverState *bdrv_find_overlay(BlockDriverState *active,
> -                                    BlockDriverState *bs);
> -BlockDriverState *bdrv_find_base(BlockDriverState *bs);
> +
> +BlockDriverState * GRAPH_RDLOCK
> +bdrv_find_overlay(BlockDriverState *active, BlockDriverState *bs);
> +
> +BlockDriverState * GRAPH_RDLOCK bdrv_find_base(BlockDriverState *bs);

Similar story to 3/24 earlier in the series - these are callers of
bdrv_skip_filters(), which in turn have callers that are already
locked, or which are touched to lock in this patch.  May be worth
tweaking the commit message to mention them by name.

Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org


Reply via email to