qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com, aliguori@us.ibm.com,
	qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <5195B8FF.6000902@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130516093239.GB8853@stefanha-thinkpad.redhat.com>

于 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 <xiawenc@linux.vnet.ibm.com>
>> ---
>>   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	other threads:[~2013-05-17  4:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15  8:43 [Qemu-devel] [PATCH 1/2] qcow2: free allocated cluster on fail in qcow2_write_snapshots() Wenchao Xia
2013-05-15  8:43 ` [Qemu-devel] [PATCH 2/2] qcow2: cancel the modification on fail in qcow2_snapshot_create() Wenchao Xia
2013-05-16  9:34   ` Stefan Hajnoczi
2013-05-16  9:32 ` [Qemu-devel] [PATCH 1/2] qcow2: free allocated cluster on fail in qcow2_write_snapshots() Stefan Hajnoczi
2013-05-17  4:58   ` Wenchao Xia [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5195B8FF.6000902@linux.vnet.ibm.com \
    --to=xiawenc@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).