qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] qcow2: free allocated cluster on fail in qc


From: Wenchao Xia
Subject: Re: [Qemu-devel] [PATCH 1/2] qcow2: free allocated cluster on fail in qcow2_write_snapshots()
Date: Fri, 17 May 2013 12:58:39 +0800
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5

于 2013-5-16 17:32, Stefan Hajnoczi 写道:
On Wed, May 15, 2013 at 04:43:38PM +0800, Wenchao Xia wrote:
Signed-off-by: Wenchao Xia <address@hidden>
---
  block/qcow2-snapshot.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 992a5c8..a6065a9 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -268,6 +268,8 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
      return 0;

  fail:
+    /* free the new snapshot table */
+    qcow2_free_clusters(bs, snapshots_offset, snapshots_size);
      return ret;
  }

snapshots_offset = qcow2_alloc_clusters(bs, snapshots_size);
offset = snapshots_offset;
if (offset < 0) {
     return offset;
}
ret = bdrv_flush(bs);
if (ret < 0) {
     return ret;
}

For completeness the bdrv_flush() return ret should be change to a goto
fail so that we cover all failure cases.

  Ok, will add those.

--
Best Regards

Wenchao Xia




reply via email to

[Prev in Thread] Current Thread [Next in Thread]