From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeKTz-0003lC-74 for qemu-devel@nongnu.org; Tue, 22 Sep 2015 06:07:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeKTy-0008Np-9G for qemu-devel@nongnu.org; Tue, 22 Sep 2015 06:07:31 -0400 Date: Tue, 22 Sep 2015 12:07:21 +0200 From: Kevin Wolf Message-ID: <20150922100721.GC3999@noname.str.redhat.com> References: <1442497700-2536-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 00/16] block: Get rid of bdrv_swap() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: qemu-block@nongnu.org, armbru@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Am 18.09.2015 um 13:03 hat Alberto Garcia geschrieben: > On Thu 17 Sep 2015 03:48:04 PM CEST, Kevin Wolf wrot= e: >=20 > > bdrv_swap() has always been an ugly hack that we would rather have > > avoided. When it was introduced, we simply didn't have the > > infrastructure to update pointers instead of transplanting the > > contents of BDS object, so we grudgingly added bdrv_swap() as a quick > > solution. Meanwhile, most of the infrastructure exists and this > > series implements the final step necessary to implement the required > > functionality in a less adventurous way. >=20 > I didn't have the chance to debug this further, but with this series if > I make a snapshot of a device with ongoing I/O I get lots of errors in > the guest: >=20 > Buffer I/O error on device vda1, logical block 3801549 > end_request: I/O error, dev vda, sector 7604516 > [...] >=20 > The drive is attached with -drive if=3Dvirtio,file=3Dfoo.qcow2,node-nam= e=3Dbar This is a stupid one. Now that bdrv_append() doesn't swap the meaning of its parameters any more, the snapshotting code makes the wrong node read-only. The more important point, though, is probably that qemu-iotests never tries to write to an image after taking an internal snapshot. Perhaps we should port the monitor to qemu-io (Beno=EEt had some patches to add it t= o qemu-nbd, which should be similar; except that a "qmp" command in qemu-io could even be simpler), so we can test monitor commands more thoroughly without launching a full qemu (which allows to use the monitor commands in isolation, but mostly means that we don't do a lot of actual I/O). Anyway, patch below. Kevin diff --git a/blockdev.c b/blockdev.c index bc158ff..8926226 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1546,7 +1546,7 @@ static void external_snapshot_commit(BlkTransaction= State *common) /* We don't need (or want) to use the transactional * bdrv_reopen_multiple() across all the entries at once, because we * don't want to abort all of them if one of them fails the reopen *= / - bdrv_reopen(state->new_bs, state->new_bs->open_flags & ~BDRV_O_RDWR, + bdrv_reopen(state->old_bs, state->old_bs->open_flags & ~BDRV_O_RDWR, NULL); =20 aio_context_release(state->aio_context);