On Wed, 21 Sep 2016 15:14:09 +0200
Greg Kurz <[email protected]> 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 <[email protected]>
> ---
> 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) {