qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] scsi-disk: Move active request asserts
@ 2010-11-12  9:57 Stefan Hajnoczi
  2010-11-12 10:13 ` [Qemu-devel] " Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2010-11-12  9:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Nigel Horne, Stefan Hajnoczi

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>
---
 hw/scsi-disk.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index dc71957..7d85899 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;
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] scsi-disk: Move active request asserts
  2010-11-12  9:57 [Qemu-devel] [PATCH] scsi-disk: Move active request asserts Stefan Hajnoczi
@ 2010-11-12 10:13 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2010-11-12 10:13 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Nigel Horne, qemu-devel

Am 12.11.2010 10:57, schrieb Stefan Hajnoczi:
> 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>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-12 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-12  9:57 [Qemu-devel] [PATCH] scsi-disk: Move active request asserts Stefan Hajnoczi
2010-11-12 10:13 ` [Qemu-devel] " Kevin Wolf

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).