From: Kevin Wolf <kwolf@redhat.com>
To: jcody@redhat.com
Cc: pbonzini@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org,
armbru@redhat.com, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/2] qapi: Introduce blockdev-group-snapshot-sync command
Date: Mon, 27 Feb 2012 18:22:42 +0100 [thread overview]
Message-ID: <4F4BBBE2.1030605@redhat.com> (raw)
In-Reply-To: <4F4BB712.8090005@redhat.com>
Am 27.02.2012 18:02, schrieb Jeff Cody:
>>> +
>>> + /* keep the same entry in bdrv_states */
>>> + pstrcpy(tmp.device_name, sizeof(tmp.device_name), bs_top->device_name);
>>> + tmp.list = bs_top->list;
>>> +
>>> + /* swap contents of the fixed new bs and the current top */
>>> + *bs_new = *bs_top;
>>> + *bs_top = tmp;
>>> +
>>> + bdrv_detach_dev(bs_new, bs_new->dev);
>>> +}
>>
>> The last line would actually deserve a comment /* clear the copied
>> fields in the new backing file */, which makes clear that there are
>> probably some more fields missing in this section.
>
> OK, added.
Only the comment or also clearing other fields? For some of them it's
very obvious that they need to be cleared (copy on read, I/O throttling).
>>> + }
>>> +
>>> + /*
>>> + * Now we will drain, flush, & pivot everything - we are committed at this
>>> + * point.
>>> + */
>>> + bdrv_drain_all();
>>
>> I would feel more comfortable if we could do the bdrv_drain_all() at the
>> very beginning of the function. Not that I know of a specific scenario
>> that would go wrong, but you have a nested main loop here that could do
>> more or less anything.
>
> I can move it up to the beginning if desired... My thought was that it
> was best to drain closer to the point of commit.
As long as we don't create new AIO requests here, drained is drained.
But anyway, I'm not requesting a change here, it was just a feeling.
>>
>>> + QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
>>> + bdrv_flush(states->old_bs);
>>
>> This can return an error which must be checked. And of course, we must
>> do it before committing to the snapshot (but after bdrv_drain_all).
>
> Hmm. If the flush returns error, do we abandon at this point? Perhaps it
> would be best to loop through and flush each device first, and if no
> flushes fail, _then_ loop through and perform the bdrv_append(). Once we
> are calling bdrv_append(), we want no possible failure points.
Yes, this is what I meant. Sorry for the somewhat vague wording.
Kevin
next prev parent reply other threads:[~2012-02-27 17:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-26 19:31 [Qemu-devel] [PATCH v2 0/2] Group Live Snapshots Jeff Cody
2012-02-26 19:31 ` [Qemu-devel] [PATCH v2 1/2] qapi: Introduce blockdev-group-snapshot-sync command Jeff Cody
2012-02-27 11:13 ` Stefan Hajnoczi
2012-02-27 14:26 ` Jeff Cody
2012-02-27 14:40 ` Stefan Hajnoczi
2012-02-27 15:23 ` Jeff Cody
2012-02-27 15:31 ` Stefan Hajnoczi
2012-02-27 15:46 ` Kevin Wolf
2012-02-27 16:51 ` Paolo Bonzini
2012-02-27 17:02 ` Jeff Cody
2012-02-27 17:22 ` Kevin Wolf [this message]
2012-02-27 17:31 ` Jeff Cody
2012-02-26 19:31 ` [Qemu-devel] [PATCH v2 2/2] QMP: Add qmp command for blockdev-group-snapshot-sync Jeff Cody
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=4F4BBBE2.1030605@redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=jcody@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).