qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] scsi-generic: don't report negative length to the SCSI adapter
@ 2010-09-02 13:27 Bernhard Kohl
  2010-09-02 14:32 ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Bernhard Kohl @ 2010-09-02 13:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Bernhard Kohl

Some drivers report an incorrect number for 'resid'. I found that for
MODE_SENSE(6) on an IET iSCSI device. This device reports the
available mode data length minus actually transferred length.

This is already a known problem:
http://tldp.org/HOWTO/SCSI-Generic-HOWTO/x356.html

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
---
 hw/scsi-generic.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 9538027..836678c 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -169,7 +169,11 @@ static void scsi_read_complete(void * opaque, int ret)
         return;
     }
     len = r->io_header.dxfer_len - r->io_header.resid;
-    DPRINTF("Data ready tag=0x%x len=%d\n", r->req.tag, len);
+    if (len < 0) {
+        len = r->io_header.dxfer_len;
+    }
+    DPRINTF("Data ready tag=0x%x len=%d dxfer_len=%d resid=%d\n",
+            r->req.tag, len, r->io_header.dxfer_len, r->io_header.resid);
 
     r->len = -1;
     r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, len);
-- 
1.7.2.2

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

end of thread, other threads:[~2010-09-02 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-02 13:27 [Qemu-devel] [PATCH] scsi-generic: don't report negative length to the SCSI adapter Bernhard Kohl
2010-09-02 14:32 ` Kevin Wolf
2010-09-02 16:17   ` Bernhard Kohl

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