qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	stefanha@gmail.com, qemu-devel@nongnu.org, dietmar@proxmox.com
Subject: Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable
Date: Wed, 03 Apr 2013 18:33:40 +0800	[thread overview]
Message-ID: <515C0584.4060503@linux.vnet.ibm.com> (raw)
In-Reply-To: <515BF023.8080701@linux.vnet.ibm.com>

于 2013-4-3 17:02, Wenchao Xia 写道:
>>
>> No, if bdrv_snapshot_delete() can fail, you need to split it in two
>> parts: one that can fail, and one that cannot.  If you cannot, then
>> there are two possibilities:
>>
>> - if the failures are minor and could be repaired with "qemu-img check
>> -r"
>> (e.g. lost clusters), then this is not optimal but can still be done;
>>
>> - otherwise, the operation simply cannot be made transactionable.
>>
>> In the case of qcow2_snapshot_delete, everything except
>>
>>      ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, nb_snapshots),
>>                             &header_data, sizeof(header_data));
>>      if (ret < 0) {
>>          goto fail;
>>      }
>>
>> must be in the prepare phase.  Everything after "fail" (which right now
>> is nothing, but it should at least undo the qcow2_alloc_clusters
>> operation)
>> must be in the rollback phase.  Everything in the middle is the commit
>> phase.
>>
>> Paolo
>>
>    Sorry I haven't state it clearly. What about bdrv_snapshot_create()
> operation? If it need to be rolled back, I think bdrv_snapshot_delete()
> will get called and it may fail. But in most case if
> bdrv_snapshot_create() succeed before, the bdrv_snapshot_delete should
> succeed also, so if fail there may be unexpected error below, could
> assert be used for this?
>
   After consideration again, I think bdrv_snapshot_create() should be
split apart like above, thank u for the tip.

-- 
Best Regards

Wenchao Xia

  parent reply	other threads:[~2013-04-03 10:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01 10:01 [Qemu-devel] [PATCH 0/3] block: make qmp_transaction extendable Wenchao Xia
2013-04-01 10:01 ` [Qemu-devel] [PATCH 1/3] block: add function deappend() Wenchao Xia
2013-04-01 10:01 ` [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable Wenchao Xia
2013-04-02 13:55   ` Kevin Wolf
2013-04-03  5:51     ` Wenchao Xia
2013-04-03  7:21       ` Paolo Bonzini
2013-04-03  9:02         ` Wenchao Xia
2013-04-03  9:17           ` Paolo Bonzini
2013-04-03  9:22           ` Kevin Wolf
2013-04-03 10:33           ` Wenchao Xia [this message]
2013-04-17 14:42   ` Stefan Hajnoczi
2013-04-18  3:00     ` Wenchao Xia
2013-04-18  6:35       ` Stefan Hajnoczi
2013-04-01 10:01 ` [Qemu-devel] [PATCH 3/3] block: change rollback sequence in qmp_transaction Wenchao Xia
2013-04-01 15:52   ` Eric Blake
2013-04-02  2:34     ` Wenchao Xia
2013-04-02 13:59   ` Kevin Wolf
2013-04-03  5:35     ` Wenchao Xia
2013-04-03  9:03       ` Kevin Wolf
2013-04-03 10:35         ` Wenchao Xia

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=515C0584.4060503@linux.vnet.ibm.com \
    --to=xiawenc@linux.vnet.ibm.com \
    --cc=dietmar@proxmox.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).