mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
block: Mark bdrv_snapshot_fallback() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_snapshot_fallback() 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-8-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
@ -3470,7 +3470,10 @@ static int img_snapshot(int argc, char **argv)
|
||||
sn.date_sec = rt / G_USEC_PER_SEC;
|
||||
sn.date_nsec = (rt % G_USEC_PER_SEC) * 1000;
|
||||
|
||||
bdrv_graph_rdlock_main_loop();
|
||||
ret = bdrv_snapshot_create(bs, &sn);
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
|
||||
if (ret) {
|
||||
error_report("Could not create snapshot '%s': %s",
|
||||
snapshot_name, strerror(-ret));
|
||||
@ -3486,6 +3489,7 @@ static int img_snapshot(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case SNAPSHOT_DELETE:
|
||||
bdrv_graph_rdlock_main_loop();
|
||||
ret = bdrv_snapshot_find(bs, &sn, snapshot_name);
|
||||
if (ret < 0) {
|
||||
error_report("Could not delete snapshot '%s': snapshot not "
|
||||
@ -3499,6 +3503,7 @@ static int img_snapshot(int argc, char **argv)
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user