From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: berto@igalia.com, armbru@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 09/13] block: Drain requests before swapping nodes in bdrv_swap()
Date: Fri, 12 Jun 2015 16:16:56 +0200 [thread overview]
Message-ID: <557AE9D8.9010607@redhat.com> (raw)
In-Reply-To: <1433944027-28533-10-git-send-email-kwolf@redhat.com>
On 10.06.2015 15:47, Kevin Wolf wrote:
> bdrv_swap() requires that there are no requests in flight on either of
> the two devices. The request coroutine would work on the wrong
> BlockDriverState object (with bs->opaque even being interpreted as a
> different type potentially) and all sorts of bad things would result
> from this.
>
> The currently existing callers mostly ensure that there is no I/O
> pending on nodes that are swapped. In detail, this is:
>
> 1. Live snapshots. This goes through qmp_transaction(), which calls
> bdrv_drain_all() before doing anything. The command is executed
> synchronously, so no new I/O can be issued concurrently.
>
> 2. snapshot=on in bdrv_open(). We're in the middle of opening the image
> (both the original image and its temporary overlay), so there can't
> be any I/O in flight yet.
>
> 3. Mirroring. bdrv_drain() is already used on the source device so that
> the mirror doesn't miss anything. However, the main loop runs between
> that and the bdrv_swap() (which is actually a bug, being addressed in
> another series), so there is a small window in which new I/O might be
> issued that would be in flight during bdrv_swap().
>
> It is safer to just drain the request queue of both devices in
> bdrv_swap() instead of relying on callers to do the right thing.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Reviewed-by: Max Reitz <mreitz@redhat.com>
next prev parent reply other threads:[~2015-06-12 14:17 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-10 13:46 [Qemu-devel] [PATCH v2 00/13] bdrv_reopen() overhaul, part 1 Kevin Wolf
2015-06-10 13:46 ` [Qemu-devel] [PATCH v2 01/13] qdict: Add qdict_array_entries() Kevin Wolf
2015-06-10 20:50 ` Eric Blake
2015-06-12 14:07 ` Max Reitz
2015-06-10 13:46 ` [Qemu-devel] [PATCH v2 02/13] qdict: Add qdict_{set, copy}_default() Kevin Wolf
2015-06-10 21:29 ` Eric Blake
2015-06-10 13:46 ` [Qemu-devel] [PATCH v2 03/13] check-qdict: Test cases for new functions Kevin Wolf
2015-06-10 21:34 ` Eric Blake
2015-06-12 14:12 ` Max Reitz
2015-06-10 13:46 ` [Qemu-devel] [PATCH v2 04/13] quorum: Use bdrv_open_image() Kevin Wolf
2015-06-10 13:46 ` [Qemu-devel] [PATCH v2 05/13] vmdk: " Kevin Wolf
2015-06-10 13:47 ` [Qemu-devel] [PATCH v2 06/13] block: Use macro for cache option names Kevin Wolf
2015-06-10 13:47 ` [Qemu-devel] [PATCH v2 07/13] block: Use QemuOpts in bdrv_open_common() Kevin Wolf
2015-06-10 21:42 ` Eric Blake
2015-06-12 14:15 ` Max Reitz
2015-06-10 13:47 ` [Qemu-devel] [PATCH v2 08/13] block: Move flag inheritance to bdrv_open_inherit() Kevin Wolf
2015-06-10 13:47 ` [Qemu-devel] [PATCH v2 09/13] block: Drain requests before swapping nodes in bdrv_swap() Kevin Wolf
2015-06-10 23:17 ` Eric Blake
2015-06-12 14:16 ` Max Reitz [this message]
2015-06-10 13:47 ` [Qemu-devel] [PATCH v2 10/13] queue.h: Add QLIST_FIX_HEAD_PTR() Kevin Wolf
2015-06-10 23:19 ` Eric Blake
2015-06-12 14:19 ` Max Reitz
2015-06-10 13:47 ` [Qemu-devel] [PATCH v2 11/13] block: Add list of children to BlockDriverState Kevin Wolf
2015-06-10 23:26 ` Eric Blake
2015-06-12 14:23 ` Max Reitz
2015-06-10 13:47 ` [Qemu-devel] [PATCH v2 12/13] block: Add BlockDriverState.inherits_from Kevin Wolf
2015-06-10 13:47 ` [Qemu-devel] [PATCH v2 13/13] block: Fix reopen flag inheritance Kevin Wolf
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=557AE9D8.9010607@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.