aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-10-27 13:15:27 +0200
committerKevin Wolf <kwolf@redhat.com>2010-11-04 13:54:37 +0100
commitd33ea50a958b2e050d2b28e5f17e3b55e91c6d74 (patch)
tree8a639706b8571ddff3447b06c656a957ef3e45f3 /hw
parent18a8d4214b861aff0caa5acfa921862d0be05bbb (diff)
scsi-disk: Fix immediate failure of bdrv_aio_*
Fix scsi-disk to use the usual completion paths that involve rerror/werror handling instead of directly completing the requests in cases where bdrv_aio_readv/writev returns NULL. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/scsi-disk.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 6815239fd4..dc719578b0 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -178,8 +178,9 @@ static void scsi_read_request(SCSIDiskReq *r)
qemu_iovec_init_external(&r->qiov, &r->iov, 1);
r->req.aiocb = bdrv_aio_readv(s->bs, r->sector, &r->qiov, n,
scsi_read_complete, r);
- if (r->req.aiocb == NULL)
- scsi_command_complete(r, CHECK_CONDITION, HARDWARE_ERROR);
+ if (r->req.aiocb == NULL) {
+ scsi_read_complete(r, -EIO);
+ }
}
/* Read more data from scsi device into buffer. */
@@ -273,9 +274,9 @@ static void scsi_write_request(SCSIDiskReq *r)
qemu_iovec_init_external(&r->qiov, &r->iov, 1);
r->req.aiocb = bdrv_aio_writev(s->bs, r->sector, &r->qiov, n,
scsi_write_complete, r);
- if (r->req.aiocb == NULL)
- scsi_command_complete(r, CHECK_CONDITION,
- HARDWARE_ERROR);
+ if (r->req.aiocb == NULL) {
+ scsi_write_complete(r, -EIO);
+ }
} else {
/* Invoke completion routine to fetch data from host. */
scsi_write_complete(r, 0);