aboutsummaryrefslogtreecommitdiff
path: root/block/blkreplay.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-10-27 17:53:33 +0200
committerKevin Wolf <kwolf@redhat.com>2023-11-08 17:56:18 +0100
commit1f051dcbdf2e4b6f518db731c84e304b2b9d15ce (patch)
treec96479cc14a8cc90443bc4f7fe46afbfa76a4006 /block/blkreplay.c
parenta4b740db5ee3db0d5b76a6ea9895875763453187 (diff)
downloadqemu-1f051dcbdf2e4b6f518db731c84e304b2b9d15ce.zip
qemu-1f051dcbdf2e4b6f518db731c84e304b2b9d15ce.tar.gz
qemu-1f051dcbdf2e4b6f518db731c84e304b2b9d15ce.tar.bz2
block: Protect bs->file with graph_lock
Almost all functions that access bs->file already take the graph lock now. Add locking to the remaining users and finally annotate the struct field itself as protected by the graph lock. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20231027155333.420094-25-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/blkreplay.c')
-rw-r--r--block/blkreplay.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/block/blkreplay.c b/block/blkreplay.c
index 04f53ee..792d980 100644
--- a/block/blkreplay.c
+++ b/block/blkreplay.c
@@ -130,7 +130,13 @@ static int coroutine_fn GRAPH_RDLOCK blkreplay_co_flush(BlockDriverState *bs)
static int blkreplay_snapshot_goto(BlockDriverState *bs,
const char *snapshot_id)
{
- return bdrv_snapshot_goto(bs->file->bs, snapshot_id, NULL);
+ BlockDriverState *file_bs;
+
+ bdrv_graph_rdlock_main_loop();
+ file_bs = bs->file->bs;
+ bdrv_graph_rdunlock_main_loop();
+
+ return bdrv_snapshot_goto(file_bs, snapshot_id, NULL);
}
static BlockDriver bdrv_blkreplay = {