[SCSI] qla2xxx: Correct short-WRITE status handling.
authorAndrew Vasquez <andrew.vasquez@qlogic.com>
Tue, 6 Dec 2005 18:58:06 +0000 (10:58 -0800)
committerJames Bottomley <jejb@mulgrave.(none)>
Wed, 7 Dec 2005 14:33:17 +0000 (09:33 -0500)
Properly check FC_RESID for any non-transfered bytes
regardless of firmware completion status.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/qla2xxx/qla_isr.c

index 09afc0f06bd4819d4dc9fd9c4650b2cda521454b..5181d966fecba13be29a57c8d1c7e7cc84b753f4 100644 (file)
@@ -909,6 +909,21 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
                        resid = resid_len;
                        cp->resid = resid;
                        CMD_RESID_LEN(cp) = resid;
+
+                       if (!lscsi_status &&
+                           ((unsigned)(cp->request_bufflen - resid) <
+                            cp->underflow)) {
+                               qla_printk(KERN_INFO, ha,
+                                   "scsi(%ld:%d:%d:%d): Mid-layer underflow "
+                                   "detected (%x of %x bytes)...returning "
+                                   "error status.\n", ha->host_no,
+                                   cp->device->channel, cp->device->id,
+                                   cp->device->lun, resid,
+                                   cp->request_bufflen);
+
+                               cp->result = DID_ERROR << 16;
+                               break;
+                       }
                }
                cp->result = DID_OK << 16 | lscsi_status;