diff options
| author | Kevin Wolf <kwolf@redhat.com> | 2023-10-27 17:53:17 +0200 |
|---|---|---|
| committer | Kevin Wolf <kwolf@redhat.com> | 2023-11-07 19:14:19 +0100 |
| commit | ad74751fc0ffdad7678224df0e752689ebb3f4b7 (patch) | |
| tree | 55eccd2af361e2a81f427b6db77106ebbb53cf3f /block/commit.c | |
| parent | 430da832afb6a6eebb7c1726991c60fb06322d3e (diff) | |
| download | focaccia-qemu-ad74751fc0ffdad7678224df0e752689ebb3f4b7.tar.gz focaccia-qemu-ad74751fc0ffdad7678224df0e752689ebb3f4b7.zip | |
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>
Diffstat (limited to 'block/commit.c')
| -rw-r--r-- | block/commit.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/block/commit.c b/block/commit.c index fc3ad79749..05eb57d9ea 100644 --- a/block/commit.c +++ b/block/commit.c @@ -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) { /* |