diff options
author | Kevin Wolf <kwolf@redhat.com> | 2023-09-29 16:51:46 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-10-12 16:31:33 +0200 |
commit | c0fc5123ad33158f6f289a896b568b9adce7d1f2 (patch) | |
tree | a589f4e13760c298ed3b8c057f756b10a89ccf77 /block | |
parent | b7cfc7d58ec697a681a269036dc8f6444ffd495d (diff) |
block: Mark bdrv_primary_child() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_primary_child() need to hold a reader lock for the graph
because it accesses the children list of a node.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230929145157.45443-12-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/snapshot.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/block/snapshot.c b/block/snapshot.c index 554065578b..ad2bf6e068 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -311,7 +311,10 @@ int bdrv_snapshot_goto(BlockDriverState *bs, * respective option (with the qdict_put_str() call above). * Assert that .bdrv_open() has attached the right BDS as primary child. */ + bdrv_graph_rdlock_main_loop(); assert(bdrv_primary_bs(bs) == fallback_bs); + bdrv_graph_rdunlock_main_loop(); + bdrv_unref(fallback_bs); return ret; } |