patch-2.2.0-pre7 linux/drivers/scsi/i91uscsi.c

Next file: linux/drivers/scsi/imm.c
Previous file: linux/drivers/scsi/gdth_proc.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre6/linux/drivers/scsi/i91uscsi.c linux/drivers/scsi/i91uscsi.c
@@ -71,6 +71,7 @@
 	12/13/98 bv, Use spinlocks instead of cli() for serialized
 		     access to HCS_Semaph, HCS_FirstAvail and HCS_LastAvail
 		     members of the HCS structure.
+	01/09/98 bv, Fix a deadlock on SMP system.
 **********************************************************************/
 
 #define DEBUG_INTERRUPT 0
@@ -221,20 +222,9 @@
 	unsigned long the_time = jiffies + amount;	/* 0.01 seconds per jiffy */
 
 #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
-	/*
-	 * We need to release the io_request_lock 
-	 * to make sure that the jiffies are updated
-	 */
-	spin_unlock_irq(&io_request_lock);
-
 	while (time_before_eq(jiffies, the_time));
-
-	/*
-	 * Acquire the io_request_lock again
-	 */
-	spin_lock_irq(&io_request_lock);
 #else
-	while (time_before(jiffies, the_time));
+	while (jiffies < the_time);
 #endif
 }
 
@@ -1037,8 +1027,17 @@
 	if ((pCurHcb->HCS_Semaph == 0) && (pCurHcb->HCS_ActScb == NULL)) {
 		TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x1F);
 		/* disable Jasmin SCSI Int        */
+
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+                spin_unlock_irqrestore(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 		tulip_main(pCurHcb);
 
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+        	spin_lock_irqsave(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 		pCurHcb->HCS_Semaph = 1;
 		TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x0F);
 
@@ -1176,8 +1175,17 @@
 		if ((pCurHcb->HCS_Semaph == 0) && (pCurHcb->HCS_ActScb == NULL)) {
 			TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x1F);
 			/* disable Jasmin SCSI Int        */
+
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+        		spin_unlock_irqrestore(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 			tulip_main(pCurHcb);
 
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+        		spin_lock_irqsave(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 			pCurHcb->HCS_Semaph = 1;
 			TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x0F);
 
@@ -1230,8 +1238,16 @@
 		/* disable Jasmin SCSI Int        */
 		pCurHcb->HCS_Semaph = 0;
 
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+        	spin_unlock_irqrestore(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 		tulip_main(pCurHcb);
 
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+                spin_lock_irqsave(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 		pCurHcb->HCS_Semaph = 1;
 		TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x0F);
 	}
@@ -1274,8 +1290,16 @@
 #endif
 	tul_post_scsi_rst(pCurHcb);
 
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+        spin_unlock_irqrestore(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 	tulip_main(pCurHcb);
 
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+        spin_lock_irqsave(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 	pCurHcb->HCS_Semaph = 1;
 	TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x0F);
 #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
@@ -1311,7 +1335,15 @@
 		/* disable Jasmin SCSI Int        */
 		pCurHcb->HCS_Semaph = 0;
 
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+        	spin_unlock_irqrestore(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
+
 		tulip_main(pCurHcb);
+
+#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
+        	spin_lock_irqsave(&(pCurHcb->HCS_SemaphLock), flags);
+#endif
 
 		pCurHcb->HCS_Semaph = 1;
 		TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x0F);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov