Signed-off-by: Wenchao Xia <xiaw...@linux.vnet.ibm.com> --- 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