[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-scsi
Subject:    [PATCH, RFC] tmscsim: kernel bugzilla bug #2139
From:       Guennadi Liakhovetski <g.liakhovetski () gmx ! de>
Date:       2004-06-30 21:33:21
Message-ID: Pine.LNX.4.60.0406302241200.8236 () poirot ! grange
[Download RAW message or body]

Hello

Short: The attached patch fixes the bug-report #2139 from kernel bugzilla.

Long: The problem is the following: on the second INQUIRY command sent 
with a Tag after the DISCONNECT / RESELECT instead of a MESSAGE-IN phase 
comes directly a DATA-IN phase. This seems a bug in the disk 
implementation, so, a proper fix would, probably, be just including the 
disk in the (tmscsim) black-list, along with 2 more disks (1 of which is 
also SEAGATE), thus disabling Tagged Queues for it. But I wanted to get it 
working as is. Yes, forgot to say - it works under 2.4, where already the 
first INQUIRY is sent with a big buffer. So, the attached patch saves the 
ActiveSRB on RESELECT, for this special case, and then, in DATA-IN phase, 
if it came without a MSG-IN phase, it is restored.

I tried to see what other drivers would do in this case, but didn't come 
up with a single recipe.

Comments are VERY welcome.

Acknowledgements: Kostas Papadopoulos has contributed a disk (SEAGATE 
ST34555N), that exhibits this problem.

Thanks
Guennadi
---
Guennadi Liakhovetski

["tmscsim-bug2139.patch" (TEXT/PLAIN)]

diff -u a/drivers/scsi/scsiiom.c b/drivers/scsi/scsiiom.c
--- a/drivers/scsi/scsiiom.c	Wed Jun 30 22:36:12 2004
+++ b/drivers/scsi/scsiiom.c	Wed Jun 30 22:24:29 2004
@@ -890,14 +890,21 @@
 
     if (pSRB == pACB->pTmpSRB)
     {
-	if (pDCB) printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (%02i-%i)\n",
-			  pDCB->TargetID, pDCB->TargetLUN);
-	else printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (DCB 0!)\n");
-
-	pSRB->pSRBDCB = pDCB;
-	dc390_EnableMsgOut_Abort (pACB, pSRB);
-	if (pDCB) pDCB->DCBFlag |= ABORT_DEV;
-	return;
+	if (pDCB) {
+		printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (%02i-%i)\n",
+			pDCB->TargetID, pDCB->TargetLUN);
+		pSRB = pSRB->pNextSRB;
+		pACB->pTmpSRB->pNextSRB = NULL;
+		pDCB->pActiveSRB = pSRB;
+	} else {
+		printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (DCB 0!)\n");
+
+		pSRB->pSRBDCB = pDCB;
+		dc390_EnableMsgOut_Abort (pACB, pSRB);
+		if (pDCB)
+			pDCB->DCBFlag |= ABORT_DEV;
+		return;
+	}
     }
 
     if( pSRB->SGIndex < pSRB->SGcount )
@@ -1242,6 +1249,7 @@
     /* TagQ: We expect a message soon, so never mind the exact SRB */
     if( pDCB->SyncMode & EN_TAG_QUEUEING )
     {
+	pACB->pTmpSRB->pNextSRB = pDCB->pActiveSRB;
 	pSRB = pACB->pTmpSRB;
 	pDCB->pActiveSRB = pSRB;
     }

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic