summaryrefslogtreecommitdiffstats
path: root/hw/scsi-disk.c
diff options
context:
space:
mode:
authorStefan Hajnoczi2010-11-12 10:57:11 +0100
committerKevin Wolf2010-11-24 17:30:19 +0100
commit6fa2c95f279dda62aa7e3292cc424ff3fab6a602 (patch)
tree75e8079858a8fb5ec6a809fd032a947911583cdc /hw/scsi-disk.c
parentmicroblaze: target-ify target_ucontext (diff)
downloadqemu-6fa2c95f279dda62aa7e3292cc424ff3fab6a602.tar.gz
qemu-6fa2c95f279dda62aa7e3292cc424ff3fab6a602.tar.xz
qemu-6fa2c95f279dda62aa7e3292cc424ff3fab6a602.zip
scsi-disk: Move active request asserts
SCSI read/write requests should not be re-issued before the current fragment of I/O completes. There are asserts in scsi-disk.c that guard this constraint but they trigger on SPARC Linux 2.4. It turns out that the asserts are too early in the code path and don't allow for read requests to terminate. Only the read assert needs to be moved but move the write assert too for consistency. Reported-by: Nigel Horne <njh@bandsman.co.uk> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r--hw/scsi-disk.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index dc719578b0..7d85899ca8 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -170,6 +170,9 @@ static void scsi_read_request(SCSIDiskReq *r)
return;
}
+ /* No data transfer may already be in progress */
+ assert(r->req.aiocb == NULL);
+
n = r->sector_count;
if (n > SCSI_DMA_BUF_SIZE / 512)
n = SCSI_DMA_BUF_SIZE / 512;
@@ -197,9 +200,6 @@ static void scsi_read_data(SCSIDevice *d, uint32_t tag)
return;
}
- /* No data transfer may already be in progress */
- assert(r->req.aiocb == NULL);
-
scsi_read_request(r);
}
@@ -269,6 +269,9 @@ static void scsi_write_request(SCSIDiskReq *r)
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
uint32_t n;
+ /* No data transfer may already be in progress */
+ assert(r->req.aiocb == NULL);
+
n = r->iov.iov_len / 512;
if (n) {
qemu_iovec_init_external(&r->qiov, &r->iov, 1);
@@ -298,9 +301,6 @@ static int scsi_write_data(SCSIDevice *d, uint32_t tag)
return 1;
}
- /* No data transfer may already be in progress */
- assert(r->req.aiocb == NULL);
-
scsi_write_request(r);
return 0;