From 372b69f503d47eb6619a98cac2ab5a6a569e3483 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 27 Oct 2023 17:53:15 +0200 Subject: block: Mark bdrv_filter_or_cow_bs() and callers GRAPH_RDLOCK This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_filter_or_cow_bs() need to hold a reader lock for the graph because it calls bdrv_filter_or_cow_child(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf Message-ID: <20231027155333.420094-7-kwolf@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- block/stream.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'block') diff --git a/block/stream.c b/block/stream.c index 51333e460b..2781441191 100644 --- a/block/stream.c +++ b/block/stream.c @@ -60,6 +60,8 @@ static int stream_prepare(Job *job) Error *local_err = NULL; int ret = 0; + GLOBAL_STATE_CODE(); + /* We should drop filter at this point, as filter hold the backing chain */ bdrv_cor_filter_drop(s->cor_filter_bs); s->cor_filter_bs = NULL; @@ -78,8 +80,10 @@ static int stream_prepare(Job *job) bdrv_drained_begin(unfiltered_bs_cow); } + bdrv_graph_rdlock_main_loop(); base = bdrv_filter_or_cow_bs(s->above_base); unfiltered_base = bdrv_skip_filters(base); + bdrv_graph_rdunlock_main_loop(); if (bdrv_cow_child(unfiltered_bs)) { const char *base_id = NULL, *base_fmt = NULL; -- cgit v1.2.3