[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 09/13] block: Drain requests before swapping
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 09/13] block: Drain requests before swapping nodes in bdrv_swap() |
Date: |
Wed, 10 Jun 2015 17:17:24 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
On 06/10/2015 07:47 AM, 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 <address@hidden>
> ---
> block.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v2 03/13] check-qdict: Test cases for new functions, (continued)
- [Qemu-devel] [PATCH v2 02/13] qdict: Add qdict_{set, copy}_default(), Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 05/13] vmdk: Use bdrv_open_image(), Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 07/13] block: Use QemuOpts in bdrv_open_common(), Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 04/13] quorum: Use bdrv_open_image(), Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 09/13] block: Drain requests before swapping nodes in bdrv_swap(), Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 10/13] queue.h: Add QLIST_FIX_HEAD_PTR(), Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 12/13] block: Add BlockDriverState.inherits_from, Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 11/13] block: Add list of children to BlockDriverState, Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 08/13] block: Move flag inheritance to bdrv_open_inherit(), Kevin Wolf, 2015/06/10
- [Qemu-devel] [PATCH v2 13/13] block: Fix reopen flag inheritance, Kevin Wolf, 2015/06/10