[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: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [PATCH 2/7] virtio-blk: handle virtio_blk_handle_request() errors |
Date: |
Wed, 21 Sep 2016 17:01:32 +0200 |
On Wed, 21 Sep 2016 16:28:34 +0200
Cornelia Huck <address@hidden> wrote:
> 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?
>
Yeah you're right. The dataplane does not call this function anymore since:
"03de2f527499 virtio-blk: do not use vring in dataplane"
I'll fix this in a preparatory patch.
> Related to your patch: You didn't change the prototype in the header :)
>
Oops... caught in the act of not running a final build before sending :)
> (...)
>
> > @@ -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?
>
Ugh, this is not intentional... and since it may go down many paths, I
won't bet there are no side effects.
I'll fix this with an explicit err_out: label.
> > + }
> > }
> >
> > if (mrb.num_reqs) {
>
>
- [Qemu-devel] [PATCH 0/7] virtio: avoid inappropriate QEMU termination, Greg Kurz, 2016/09/21
- [Qemu-devel] [PATCH 2/7] virtio-blk: handle virtio_blk_handle_request() errors, Greg Kurz, 2016/09/21
- [Qemu-devel] [PATCH 3/7] virtio-net: handle virtio_net_handle_ctrl() error, Greg Kurz, 2016/09/21
- [Qemu-devel] [PATCH 4/7] virtio-net: handle virtio_net_receive() errors, Greg Kurz, 2016/09/21
- [Qemu-devel] [PATCH 5/7] virtio-net: handle virtio_net_flush_tx() errors, Greg Kurz, 2016/09/21
- [Qemu-devel] [PATCH 6/7] virtio-scsi: convert virtio_scsi_bad_req() to use virtio_error(), Greg Kurz, 2016/09/21
- [Qemu-devel] [PATCH 7/7] virtio-scsi: handle virtio_scsi_set_config() error, Greg Kurz, 2016/09/21
- Re: [Qemu-devel] [PATCH 0/7] virtio: avoid inappropriate QEMU termination, no-reply, 2016/09/21