[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] qcow2: cancel the modification on fail in q
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] qcow2: cancel the modification on fail in qcow2_snapshot_create() |
Date: |
Thu, 16 May 2013 11:34:07 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, May 15, 2013 at 04:43:39PM +0800, Wenchao Xia wrote:
> 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);
This patch is missing goto restore_refcount and goto dealloc_cluster.