[5240] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

last_reset == 0 means nothing in scsi code

daemon@ATHENA.MIT.EDU (Andrea Arcangeli)
Mon Nov 30 06:24:47 1998

Date: 	Mon, 30 Nov 1998 11:48:59 +0100 (CET)
From: Andrea Arcangeli <andrea@e-mind.com>
To: Gerard Roudier <groudier@club-internet.fr>
cc: linux-kernel@vger.rutgers.edu, linux-scsi@vger.rutgers.edu
In-Reply-To: <Pine.LNX.3.96.981130001405.26425F-100000@dragon.bogus>

I developed a very very experimental patch. I have no idea if it can be
right. I can try it only with my ppa drive and works but I never had a
scsi reset with ppa... Soon I' ll hack ppa forcing it to cause a scsi
reset to see the code in action. 

Comments?

BTW, the patch is only a snapshot, it will not apply cleanly to 2.1.130.

Index: drivers/scsi//hosts.c
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/hosts.c,v
retrieving revision 1.1.1.1.2.3
diff -u -r1.1.1.1.2.3 hosts.c
--- hosts.c	1998/11/30 08:47:56	1.1.1.1.2.3
+++ hosts.c	1998/11/30 10:30:05
@@ -581,7 +581,8 @@
     next_scsi_host++;
     retval->host_queue = NULL;
     retval->host_wait = NULL;
-    retval->last_reset = jiffies - 3600*HZ; /* set a bit ago to be safe */
+    retval->resetting = 0;
+    /* retval->last_reset don' t need to be set because resetting is 0 -arca */
     retval->irq = 0;
     retval->dma_channel = 0xff;
 
Index: drivers/scsi//hosts.h
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/hosts.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 hosts.h
--- hosts.h	1998/11/19 23:02:39	1.1.1.1
+++ hosts.h	1998/11/30 10:27:41
@@ -320,6 +320,7 @@
 /* public: */
     unsigned short extra_bytes;
     unsigned short host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
+    int resetting; /* if set, it means that last_reset is a valid value */
     unsigned long last_reset;
 
 
Index: drivers/scsi//scsi.c
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/scsi.c,v
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1.2.1 scsi.c
--- scsi.c	1998/11/19 23:15:31	1.1.1.1.2.1
+++ scsi.c	1998/11/30 10:41:05
@@ -1297,7 +1297,7 @@
      */
     timeout = host->last_reset + MIN_RESET_DELAY;
 
-    if (time_before(jiffies, timeout)) {
+    if (host->resetting && time_before(jiffies, timeout)) {
 	int ticks_remaining = timeout - jiffies;
 	/*
 	 * NOTE: This may be executed from within an interrupt
@@ -1310,7 +1310,7 @@
 	 */
 	spin_unlock_irq(&io_request_lock);
 	while (--ticks_remaining >= 0) mdelay(1+999/HZ);
-	host->last_reset = jiffies - MIN_RESET_DELAY;
+        host->resetting = 0;
 	spin_lock_irq(&io_request_lock);
     }
 
Index: drivers/scsi//scsi_obsolete.c
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/scsi_obsolete.c,v
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.1.2.2 scsi_obsolete.c
--- scsi_obsolete.c	1998/11/30 00:39:26	1.1.1.1.2.2
+++ scsi_obsolete.c	1998/11/30 10:41:43
@@ -607,8 +607,9 @@
 	if ((++SCpnt->retries) < SCpnt->allowed)
 	{
 	    if ((SCpnt->retries >= (SCpnt->allowed >> 1))
-                && time_after(jiffies, SCpnt->host->last_reset
-                              + MIN_RESET_PERIOD)
+                && (SCpnt->host->resetting &&
+                    time_after(jiffies, SCpnt->host->last_reset
+                              + MIN_RESET_PERIOD))
 		&& !(SCpnt->flags & WAS_RESET))
 	    {
 		printk("scsi%d channel %d : resetting for second half of retries.\n",
@@ -934,6 +935,12 @@
                 }
 
 		host->last_reset = jiffies;
+                host->resetting = 1;
+                /*
+                 * I suppose that the host reset callback will not play
+                 * with the resetting field. We have just set the resetting
+                 * flag here. -arca
+                 */
 		temp = host->hostt->reset(SCpnt, reset_flags);
 		/*
 		  This test allows the driver to introduce an additional bus
@@ -952,7 +959,13 @@
 	    {
 		if (!host->block) host->host_busy++;
 		host->last_reset = jiffies;
+		host->resetting = 1;
 	        SCpnt->flags |= (WAS_RESET | IS_RESETTING);
+                /*
+                 * I suppose that the host reset callback will not play
+                 * with the resetting field. We have just set the resetting
+                 * flag here. -arca
+                 */
 		temp = host->hostt->reset(SCpnt, reset_flags);
 		if (time_before(host->last_reset, jiffies) ||
 		    (time_after(host->last_reset, jiffies + 20 * HZ)))


Can be right to consider the resetting expired when we send the first
normal scsi command to the lowlevel driver?

Andrea Arcangeli


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post