Patchwork [3/3] virtio-blk: Fix error cases which ignored rerror/werror

login
register
mail settings
Submitter Kevin Wolf
Date Jan. 27, 2010, 12:12 p.m.
Message ID <1264594356-10375-4-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/43791/
State New
Headers show

Comments

Kevin Wolf - Jan. 27, 2010, 12:12 p.m.
If an I/O request fails right away instead of getting an error only in the
callback, we still need to consider rerror/werror.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/virtio-blk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Christoph Hellwig - Jan. 27, 2010, 6:21 p.m.
On Wed, Jan 27, 2010 at 01:12:36PM +0100, Kevin Wolf wrote:
> If an I/O request fails right away instead of getting an error only in the
> callback, we still need to consider rerror/werror.

Looks good,


Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 5a413b9..037a79c 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -269,7 +269,7 @@  static void do_multiwrite(BlockDriverState *bs, BlockRequest *blkreq,
     if (ret != 0) {
         for (i = 0; i < num_writes; i++) {
             if (blkreq[i].error) {
-                virtio_blk_req_complete(blkreq[i].opaque, VIRTIO_BLK_S_IOERR);
+                virtio_blk_rw_complete(blkreq[i].opaque, -EIO);
             }
         }
     }
@@ -313,7 +313,7 @@  static void virtio_blk_handle_read(VirtIOBlockReq *req)
     acb = bdrv_aio_readv(req->dev->bs, req->out->sector, &req->qiov,
                          req->qiov.size / 512, virtio_blk_rw_complete, req);
     if (!acb) {
-        virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
+        virtio_blk_rw_complete(req, -EIO);
     }
 }