From: Kevin Wolf Date: Mon, 11 Sep 2023 09:46:16 +0000 (+0200) Subject: block: Take graph rdlock in bdrv_drop_intermediate() X-Git-Tag: pull-xenfv-stable-20231106~84^2~11 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=733467a1e6067070a8b641f51675d0cb5b715a83;p=users%2Fdwmw2%2Fqemu.git block: Take graph rdlock in bdrv_drop_intermediate() The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Message-ID: <20230911094620.45040-18-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- diff --git a/block.c b/block.c index 06d2a1b256..e024a6ccec 100644 --- a/block.c +++ b/block.c @@ -5938,9 +5938,11 @@ int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base, backing_file_str = base->filename; } + bdrv_graph_rdlock_main_loop(); QLIST_FOREACH(c, &top->parents, next_parent) { updated_children = g_slist_prepend(updated_children, c); } + bdrv_graph_rdunlock_main_loop(); /* * It seems correct to pass detach_subchain=true here, but it triggers