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: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 1/2] qcow2: free allocated cluster on fail in qcow2_write_snapshots()
Date: Thu, 16 May 2013 11:32:39 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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.



reply via email to

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