mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-06 00:00:42 -07:00
block: Mark bdrv_skip_filters() and callers GRAPH_RDLOCK
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 <kwolf@redhat.com> Message-ID: <20231027155333.420094-9-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
430da832af
commit
ad74751fc0
9 changed files with 77 additions and 31 deletions
|
|
@ -255,10 +255,13 @@ void commit_start(const char *job_id, BlockDriverState *bs,
|
|||
GLOBAL_STATE_CODE();
|
||||
|
||||
assert(top != bs);
|
||||
bdrv_graph_rdlock_main_loop();
|
||||
if (bdrv_skip_filters(top) == bdrv_skip_filters(base)) {
|
||||
error_setg(errp, "Invalid files for merge: top and base are the same");
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
return;
|
||||
}
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
|
||||
base_size = bdrv_getlength(base);
|
||||
if (base_size < 0) {
|
||||
|
|
@ -324,6 +327,7 @@ void commit_start(const char *job_id, BlockDriverState *bs,
|
|||
* this is the responsibility of the interface (i.e. whoever calls
|
||||
* commit_start()).
|
||||
*/
|
||||
bdrv_graph_wrlock(top);
|
||||
s->base_overlay = bdrv_find_overlay(top, base);
|
||||
assert(s->base_overlay);
|
||||
|
||||
|
|
@ -342,7 +346,6 @@ void commit_start(const char *job_id, BlockDriverState *bs,
|
|||
*/
|
||||
iter_shared_perms = BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE;
|
||||
|
||||
bdrv_graph_wrlock(top);
|
||||
for (iter = top; iter != base; iter = bdrv_filter_or_cow_bs(iter)) {
|
||||
if (iter == filtered_base) {
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue