qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/7] virtio-blk: handle virtio_blk_handle_reques


From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH 2/7] virtio-blk: handle virtio_blk_handle_request() errors
Date: Wed, 21 Sep 2016 16:28:34 +0200

On Wed, 21 Sep 2016 15:14:09 +0200
Greg Kurz <address@hidden> wrote:

> All these errors are caused by a buggy guest: let's switch the device to
> the broken state instead of terminating QEMU.
> 
> Signed-off-by: Greg Kurz <address@hidden>
> ---
>  hw/block/virtio-blk.c |   27 +++++++++++++++++----------
>  1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index 3a6112fbf4c4..1285d196a40f 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -468,30 +468,32 @@ static bool virtio_blk_sect_range_ok(VirtIOBlock *dev,
>      return true;
>  }
> 
> -void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
> +int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)

Unrelated to your patch: It seems there are no callers (left) outside
of this file; should the function be made static?

Related to your patch: You didn't change the prototype in the header :)

(...)

> @@ -586,7 +589,9 @@ void virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq)
>      blk_io_plug(s->blk);
> 
>      while ((req = virtio_blk_get_request(s, vq))) {
> -        virtio_blk_handle_request(req, &mrb);
> +        if (virtio_blk_handle_request(req, &mrb)) {
> +            return;

Does the missing blk_io_unplug() have any side-effects outside of this
device, which is broken anyway?

> +        }
>      }
> 
>      if (mrb.num_reqs) {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]