[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] qcow2: cancel the modification on fail in qcow2
From: |
Wenchao Xia |
Subject: |
[Qemu-devel] [PATCH 2/2] qcow2: cancel the modification on fail in qcow2_snapshot_create() |
Date: |
Wed, 15 May 2013 16:43:39 +0800 |
Signed-off-by: Wenchao Xia <address@hidden>
---
block/qcow2-snapshot.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index a6065a9..ad030f9 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -410,6 +410,17 @@ int qcow2_snapshot_create(BlockDriverState *bs,
QEMUSnapshotInfo *sn_info)
#endif
return 0;
+restore_refcount:
+ ret = qcow2_update_snapshot_refcount(bs, s->l1_table_offset,
+ s->l1_size, -1);
+ if (ret < 0) {
+ /* Nothing can be done none now, need image check later */
+ error_report("qcow2: Error in restoring refcount in snapshot");
+ }
+
+dealloc_cluster:
+ qcow2_free_clusters(bs, sn->l1_table_offset, sn->l1_size);
+
fail:
g_free(sn->id_str);
g_free(sn->name);
--
1.7.1