[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V3 2/7] qcow2: free allocated cluster on fail in qco
From: |
Wenchao Xia |
Subject: |
[Qemu-devel] [PATCH V3 2/7] qcow2: free allocated cluster on fail in qcow2_write_snapshots() |
Date: |
Mon, 9 Sep 2013 10:57:57 +0800 |
Signed-off-by: Wenchao Xia <address@hidden>
---
block/qcow2-snapshot.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 40393b2..9e2d695 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -186,7 +186,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
}
ret = bdrv_flush(bs);
if (ret < 0) {
- return ret;
+ goto fail;
}
/* The snapshot list position has not yet been updated, so these clusters
@@ -194,7 +194,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offset,
s->snapshots_size);
if (ret < 0) {
- return ret;
+ goto fail;
}
@@ -278,6 +278,9 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
return 0;
fail:
+ /* free the new snapshot table */
+ qcow2_free_clusters(bs, snapshots_offset, snapshots_size,
+ QCOW2_DISCARD_ALWAYS);
return ret;
}
--
1.7.1
- [Qemu-devel] [PATCH V3 0/7] qcow2: rollback the modification on fail in snapshot creation, Wenchao Xia, 2013/09/08
- [Qemu-devel] [PATCH V3 3/7] qcow2: cancel the modification on fail in qcow2_snapshot_create(), Wenchao Xia, 2013/09/08
- [Qemu-devel] [PATCH V3 2/7] qcow2: free allocated cluster on fail in qcow2_write_snapshots(),
Wenchao Xia <=
- [Qemu-devel] [PATCH V3 6/7] qcow2: print message for error path in snapshot creation, Wenchao Xia, 2013/09/08
- [Qemu-devel] [PATCH V3 1/7] qcow2: restore nb_snapshots when fail in snapshot creation, Wenchao Xia, 2013/09/08
- [Qemu-devel] [PATCH V3 4/7] blkdebug: add debug events for snapshot, Wenchao Xia, 2013/09/08
- [Qemu-devel] [PATCH V3 7/7] qemu-iotests: add test for qcow2 snapshot, Wenchao Xia, 2013/09/08
- [Qemu-devel] [PATCH V3 5/7] qcow2: use debug events for snapshot, Wenchao Xia, 2013/09/08