summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Reitz2013-10-09 14:42:00 +0200
committerKevin Wolf2013-10-11 16:50:00 +0200
commit84757f7e67cda3df8b04e06fbdeecc266415d2f3 (patch)
tree434dad1032c0a6b7ff077d2fe62c68bdd2cf8b21
parentqcow2: Remove wrong metadata overlap check (diff)
downloadqemu-84757f7e67cda3df8b04e06fbdeecc266415d2f3.tar.gz
qemu-84757f7e67cda3df8b04e06fbdeecc266415d2f3.tar.xz
qemu-84757f7e67cda3df8b04e06fbdeecc266415d2f3.zip
qcow2: Fix snapshot restoration in snapshot_create
If the new snapshot table could not be written in qcow2_snapshot_create, the old snapshot table has to be restored in memory and the new one released. This should include restoration of the old snapshot count as well, which is added by this patch. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/qcow2-snapshot.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 812dab2aa5..fe7e14cc89 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -433,6 +433,7 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
if (ret < 0) {
g_free(s->snapshots);
s->snapshots = old_snapshot_list;
+ s->nb_snapshots--;
goto fail;
}