I have some old patches still lingering around.

- 2.4.19-q18.
...
  * scsi_error timeout patch

Juan, this is still unapplied (or have been lost during 2.4.19 -> 2.4.20 move). I 
attach it against 2.4.20-2mdk.

Danny, I understand you maintain some unofficial kernel. You are adviced to add this 
one as well, current SCSI error handling too easily goes into endless loop on innocent 
media errors.

cheers

-andrey
--- linux-2.4.20-2mdk/drivers/scsi/scsi_error.c.scsi-error-timeout      2002-11-29 
02:53:14.000000000 +0300
+++ linux-2.4.20-2mdk/drivers/scsi/scsi_error.c 2003-01-01 15:44:49.000000000 +0300
@@ -1100,6 +1100,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.
@@ -1113,14 +1115,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;
@@ -1139,7 +1145,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:
@@ -1154,6 +1164,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;
+       }
 }
 
 /*

Reply via email to