* [Qemu-devel] [PATCH] virtio-blk: handle NULL returns from bdrv_aio_{read, write}
@ 2009-08-13 14:49 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2009-08-13 14:49 UTC (permalink / raw)
To: qemu-devel
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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-08-13 14:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-13 14:49 [Qemu-devel] [PATCH] virtio-blk: handle NULL returns from bdrv_aio_{read, write} Christoph Hellwig
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).