Skip to content

Commit

Permalink
block: Take graph rdlock in bdrv_drop_intermediate()
Browse files Browse the repository at this point in the history
The function reads the parents list, so it needs to hold the graph lock.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Message-ID: <20230911094620.45040-18-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
kevmw committed Sep 20, 2023
1 parent 356f4ef commit 733467a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 733467a

Please sign in to comment.