Re: Patches for SCSI timeout bug

From: J.A. Magallon (jamagallon@able.es)
Date: Wed Jun 04 2003 - 16:44:43 EST


On 06.04, linas@austin.ibm.com wrote:
>
>
> Hi,
>
> I've got a SCSI timeout bug in kernels 2.4 and 2.5, and several
> different patches (appended) that fix it. I'm not sure which way
> of fixing it is best.
>
[...]

Can you try with this:

--- linux-2.4.18-18mdk/drivers/scsi/scsi_error.c.scsi-eh-timeout Thu May 30 16:22:37 2002
+++ linux-2.4.18-18mdk/drivers/scsi/scsi_error.c Sun Jun 9 19:18:11 2002
@@ -1103,6 +1103,8 @@
  */
 STATIC int scsi_eh_completed_normally(Scsi_Cmnd * SCpnt)
 {
+ int rtn;
+
         /*
          * First check the host byte, to see if there is anything in there
          * that would indicate what we need to do.
@@ -1116,14 +1118,18 @@
                          * otherwise we just flag it as success.
                          */
                         SCpnt->flags &= ~IS_RESETTING;
- return NEEDS_RETRY;
+ goto maybe_retry;
                 }
                 /*
                  * Rats. We are already in the error handler, so we now get to try
                  * and figure out what to do next. If the sense is valid, we have
                  * a pretty good idea of what to do. If not, we mark it as failed.
                  */
- return scsi_check_sense(SCpnt);
+ rtn = scsi_check_sense(SCpnt);
+ if (rtn == NEEDS_RETRY) {
+ goto maybe_retry;
+ }
+ return rtn;
         }
         if (host_byte(SCpnt->result) != DID_OK) {
                 return FAILED;
@@ -1142,7 +1148,11 @@
         case COMMAND_TERMINATED:
                 return SUCCESS;
         case CHECK_CONDITION:
- return scsi_check_sense(SCpnt);
+ rtn = scsi_check_sense(SCpnt);
+ if (rtn == NEEDS_RETRY) {
+ goto maybe_retry;
+ }
+ return rtn;
         case CONDITION_GOOD:
         case INTERMEDIATE_GOOD:
         case INTERMEDIATE_C_GOOD:
@@ -1157,6 +1167,17 @@
                 return FAILED;
         }
         return FAILED;
+
+ maybe_retry:
+
+ if ((++SCpnt->retries) < SCpnt->allowed) {
+ return NEEDS_RETRY;
+ } else {
+ /*
+ * No more retries - report this one back to upper level.
+ */
+ return SUCCESS;
+ }
 }
 
 /*

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.2 (Cooker) for i586
Linux 2.4.21-rc7-jam1 (gcc 3.3 (Mandrake Linux 9.2 3.3-1mdk))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 07 2003 - 22:00:25 EST