summaryrefslogtreecommitdiff
path: root/hw/virtio-blk.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-01-27 13:12:35 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-29 09:53:01 -0600
commitf1b5286803ee66f73034f1f5e0e1cf14f4415f94 (patch)
tree9a47d0fc8e4ffbe91edc1e32ad5532e4fffa12c7 /hw/virtio-blk.c
parentbc6694d43a68baa864dba7742354a379a3347f33 (diff)
downloadqemu-f1b5286803ee66f73034f1f5e0e1cf14f4415f94.tar.gz
qemu-f1b5286803ee66f73034f1f5e0e1cf14f4415f94.tar.bz2
qemu-f1b5286803ee66f73034f1f5e0e1cf14f4415f94.zip
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 <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-blk.c')
-rw-r--r--hw/virtio-blk.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 82f96e52af..5a413b9429 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -384,6 +384,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;
@@ -391,10 +395,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)