From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Na6mG-0001eL-0w for qemu-devel@nongnu.org; Wed, 27 Jan 2010 07:13:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Na6mB-0001cd-6o for qemu-devel@nongnu.org; Wed, 27 Jan 2010 07:13:43 -0500 Received: from [199.232.76.173] (port=33606 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Na6mA-0001cO-Qo for qemu-devel@nongnu.org; Wed, 27 Jan 2010 07:13:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22314) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Na6mA-0004uM-Gp for qemu-devel@nongnu.org; Wed, 27 Jan 2010 07:13:38 -0500 From: Kevin Wolf Date: Wed, 27 Jan 2010 13:12:35 +0100 Message-Id: <1264594356-10375-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1264594356-10375-1-git-send-email-kwolf@redhat.com> References: <1264594356-10375-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 2/3] virtio-blk: Fix restart after read error List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: hch@lst.de 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 --- hw/virtio-blk.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 82f96e5..5a413b9 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) -- 1.6.5.2