qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] dataplane: fix virtio_blk_data_plane_create() op blocker error path
@ 2014-09-11 12:49 Stefan Hajnoczi
  2014-09-11 13:03 ` Eric Blake
  2014-09-11 14:22 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-09-11 12:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Fam Zheng, Stefan Hajnoczi

Commit 3718d8ab65f68de2acccbe6a315907805f54e3cc ("block: Replace in_use
with operation blocker") broke the error path because it consumed
local_err instead of propagating it.

The caller has no way to know that the function failed.  This caused
virtio-blk to start "successfully" even though there was a fatal
dataplane error.

Steps to reproduce:

  $ qemu-system-x86_64 -enable-kvm -object iothread,id=iothread0 \
                       -drive if=none,id=drive0,file=a.img \
  (qemu) drive_mirror drive0 /tmp/foo.img
  (qemu) device_add virtio-blk-pci,iothread=iothread0,drive=drive0

Expected result:

  Since the mirror block job is using drive0 it is not possible to start
  virtio-blk data-plane.

  device_add fails and the PCI adapter is not added.

Actual result:

  device_add completes and the PCI adapter is added.

Cc: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/block/dataplane/virtio-blk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index b55188c..5458f9d 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -164,8 +164,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
      * block jobs that can conflict.
      */
     if (bdrv_op_is_blocked(blk->conf.bs, BLOCK_OP_TYPE_DATAPLANE, &local_err)) {
-        error_report("cannot start dataplane thread: %s",
-                      error_get_pretty(local_err));
+        error_setg(errp, "cannot start dataplane thread: %s",
+                   error_get_pretty(local_err));
         error_free(local_err);
         return;
     }
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] dataplane: fix virtio_blk_data_plane_create() op blocker error path
  2014-09-11 12:49 [Qemu-devel] [PATCH] dataplane: fix virtio_blk_data_plane_create() op blocker error path Stefan Hajnoczi
@ 2014-09-11 13:03 ` Eric Blake
  2014-09-11 14:22 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2014-09-11 13:03 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Kevin Wolf, Fam Zheng

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

On 09/11/2014 06:49 AM, Stefan Hajnoczi wrote:
> Commit 3718d8ab65f68de2acccbe6a315907805f54e3cc ("block: Replace in_use
> with operation blocker") broke the error path because it consumed
> local_err instead of propagating it.
> 
> The caller has no way to know that the function failed.  This caused
> virtio-blk to start "successfully" even though there was a fatal
> dataplane error.
> 

> ---
>  hw/block/dataplane/virtio-blk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] dataplane: fix virtio_blk_data_plane_create() op blocker error path
  2014-09-11 12:49 [Qemu-devel] [PATCH] dataplane: fix virtio_blk_data_plane_create() op blocker error path Stefan Hajnoczi
  2014-09-11 13:03 ` Eric Blake
@ 2014-09-11 14:22 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2014-09-11 14:22 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Fam Zheng, qemu-devel

Am 11.09.2014 um 14:49 hat Stefan Hajnoczi geschrieben:
> Commit 3718d8ab65f68de2acccbe6a315907805f54e3cc ("block: Replace in_use
> with operation blocker") broke the error path because it consumed
> local_err instead of propagating it.
> 
> The caller has no way to know that the function failed.  This caused
> virtio-blk to start "successfully" even though there was a fatal
> dataplane error.
> 
> Steps to reproduce:
> 
>   $ qemu-system-x86_64 -enable-kvm -object iothread,id=iothread0 \
>                        -drive if=none,id=drive0,file=a.img \
>   (qemu) drive_mirror drive0 /tmp/foo.img
>   (qemu) device_add virtio-blk-pci,iothread=iothread0,drive=drive0
> 
> Expected result:
> 
>   Since the mirror block job is using drive0 it is not possible to start
>   virtio-blk data-plane.
> 
>   device_add fails and the PCI adapter is not added.
> 
> Actual result:
> 
>   device_add completes and the PCI adapter is added.
> 
> Cc: Fam Zheng <famz@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-11 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11 12:49 [Qemu-devel] [PATCH] dataplane: fix virtio_blk_data_plane_create() op blocker error path Stefan Hajnoczi
2014-09-11 13:03 ` Eric Blake
2014-09-11 14:22 ` Kevin Wolf

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