qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: hch@lst.de
Subject: [Qemu-devel] [PATCH 2/3] virtio-blk: Fix restart after read error
Date: Wed, 27 Jan 2010 13:12:35 +0100	[thread overview]
Message-ID: <1264594356-10375-3-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1264594356-10375-1-git-send-email-kwolf@redhat.com>

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>
---
 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

  parent reply	other threads:[~2010-01-27 12:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 12:12 [Qemu-devel] [PATCH 0/3] virtio-blk: rerror/werror fixes (including corruption fix) Kevin Wolf
2010-01-27 12:12 ` [Qemu-devel] [PATCH 1/3] virtio_blk: Factor virtio_blk_handle_request out Kevin Wolf
2010-01-27 18:20   ` [Qemu-devel] " Christoph Hellwig
2010-01-29 20:43   ` [Qemu-devel] " Anthony Liguori
2010-01-27 12:12 ` Kevin Wolf [this message]
2010-01-27 18:20   ` [Qemu-devel] Re: [PATCH 2/3] virtio-blk: Fix restart after read error Christoph Hellwig
2010-01-27 12:12 ` [Qemu-devel] [PATCH 3/3] virtio-blk: Fix error cases which ignored rerror/werror Kevin Wolf
2010-01-27 18:21   ` [Qemu-devel] " Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1264594356-10375-3-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).