From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] virtio-blk: handle NULL returns from bdrv_aio_{read, write}
Date: Thu, 13 Aug 2009 16:49:56 +0200 [thread overview]
Message-ID: <20090813144956.GA8364@lst.de> (raw)
The bdrv_aio_{read,write} routines can return a NULL pointer when the
I/O submission fails. Currently we ignore this and will wait forever
for an I/O completion and leading to a hang of the guest.
I can easily reproduce this using the native Linux AIO patch, but it's
also possible using normal pthreads-based AIO.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: qemu-kvm/hw/virtio-blk.c
===================================================================
--- qemu-kvm.orig/hw/virtio-blk.c
+++ qemu-kvm/hw/virtio-blk.c
@@ -254,14 +254,24 @@ static void virtio_blk_handle_scsi(VirtI
static void virtio_blk_handle_write(VirtIOBlockReq *req)
{
- bdrv_aio_writev(req->dev->bs, req->out->sector, &req->qiov,
- req->qiov.size / 512, virtio_blk_rw_complete, req);
+ BlockDriverAIOCB *acb;
+
+ acb = bdrv_aio_writev(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);
+ }
}
static void virtio_blk_handle_read(VirtIOBlockReq *req)
{
- bdrv_aio_readv(req->dev->bs, req->out->sector, &req->qiov,
- req->qiov.size / 512, virtio_blk_rw_complete, req);
+ BlockDriverAIOCB *acb;
+
+ 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);
+ }
}
static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
reply other threads:[~2009-08-13 14:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090813144956.GA8364@lst.de \
--to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.