From: Kevin Wolf Date: Wed, 27 Jan 2010 12:12:35 +0000 (+0100) Subject: virtio-blk: Fix restart after read error X-Git-Tag: v0.12.3~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=096109c8049f2821f57561f4b24d7f51c6d53ddd;p=thirdparty%2Fqemu.git virtio-blk: Fix restart after read error Current code assumes that only write requests are ever going to be restarted. This is wrong since rerror=stop exists. Instead of directly starting writes, use the same request processing as used for new requests. Signed-off-by: Kevin Wolf Signed-off-by: Anthony Liguori (cherry picked from commit f1b5286803ee66f73034f1f5e0e1cf14f4415f94) --- diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 83248de49a3..136e4606213 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -387,6 +387,10 @@ static void virtio_blk_dma_restart_bh(void *opaque) { VirtIOBlock *s = opaque; VirtIOBlockReq *req = s->rq; + MultiReqBuffer mrb = { + .num_writes = 0, + .old_bs = NULL, + }; qemu_bh_delete(s->bh); s->bh = NULL; @@ -394,10 +398,13 @@ static void virtio_blk_dma_restart_bh(void *opaque) s->rq = NULL; while (req) { - bdrv_aio_writev(req->dev->bs, req->out->sector, &req->qiov, - req->qiov.size / 512, virtio_blk_rw_complete, req); + virtio_blk_handle_request(req, &mrb); req = req->next; } + + if (mrb.num_writes > 0) { + do_multiwrite(mrb.old_bs, mrb.blkreq, mrb.num_writes); + } } static void virtio_blk_dma_restart_cb(void *opaque, int running, int reason)