Re: [Qemu-block] [PATCH 00/16] block: Get rid of bdrv_swap()

2015-09-24 Thread Alberto Garcia
On Thu 17 Sep 2015 03:48:04 PM CEST, Kevin Wolf wrote:

> 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.

I managed to crash QEMU with this series. I don't think it's a problem
it the series itself, but rather some older bug that is triggered by
your patches.

I think I found the cause and I have a preliminary patch, I'll try to
send it tomorrow.

Berto



Re: [Qemu-block] [PATCH 00/16] block: Get rid of bdrv_swap()

2015-09-22 Thread Kevin Wolf
Am 18.09.2015 um 13:03 hat Alberto Garcia geschrieben:
> On Thu 17 Sep 2015 03:48:04 PM CEST, Kevin Wolf  wrote:
> 
> > 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.
> 
> 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:
> 
> Buffer I/O error on device vda1, logical block 3801549
> end_request: I/O error, dev vda, sector 7604516
> [...]
> 
> The drive is attached with -drive if=virtio,file=foo.qcow2,node-name=bar

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Ʈt had some patches to add it to
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(BlkTransactionState 
*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);
 
 aio_context_release(state->aio_context);



Re: [Qemu-block] [PATCH 00/16] block: Get rid of bdrv_swap()

2015-09-18 Thread Alberto Garcia
On Thu 17 Sep 2015 03:48:04 PM CEST, Kevin Wolf  wrote:

> 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.

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:

Buffer I/O error on device vda1, logical block 3801549
end_request: I/O error, dev vda, sector 7604516
[...]

The drive is attached with -drive if=virtio,file=foo.qcow2,node-name=bar

Berto