]> git.hungrycats.org Git - linux/commitdiff
Fix loop problem in SCSI error handler sense collection
authorJames Bottomley <jejb@raven.il.steeleye.com>
Sat, 8 Mar 2003 03:03:45 +0000 (21:03 -0600)
committerJames Bottomley <jejb@raven.il.steeleye.com>
Sat, 8 Mar 2003 03:03:45 +0000 (21:03 -0600)
Also remove previous work around so sense is collected now if the
driver doesn't do it automatically.

Also fix a problem where the retries get reset when the command is
reissued (we only want the retries set when the command is first
created).

drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c

index 9235de3f17206aefa60af57babcbdeaf2c99ee84..eec12d6a61ba3deed917a8dee0ead22c1d6ffde0 100644 (file)
@@ -701,25 +701,14 @@ static int scsi_eh_get_sense(struct list_head *work_q,
                 * upper level.
                 */
                if (rtn == SUCCESS)
-                       scsi_eh_finish_cmd(scmd, done_q);
-               if (rtn != NEEDS_RETRY)
-                       continue;
-
-               /*
-                * we only come in here if we want to retry a
-                * command.  the test to see whether the command
-                * should be retried should be keeping track of the
-                * number of tries, so we don't end up looping, of
-                * course.
-                */
-               scmd->state = NEEDS_RETRY;
-               rtn = scsi_eh_retry_cmd(scmd);
-               if (rtn != SUCCESS)
+                       /* we don't want this command reissued, just
+                        * finished with the sense data, so set
+                        * retries to the max allowed to ensure it
+                        * won't get reissued */
+                       scmd->retries = scmd->allowed;
+               else if (rtn != NEEDS_RETRY)
                        continue;
 
-               /*
-                * we eventually hand this one back to the top level.
-                */
                scsi_eh_finish_cmd(scmd, done_q);
        }
 
@@ -1321,9 +1310,11 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                rtn = scsi_check_sense(scmd);
                if (rtn == NEEDS_RETRY)
                        goto maybe_retry;
-               /* if rtn == FAILED, we have no sense information */
-               /* was: return rtn; */
-               return SUCCESS;
+               /* if rtn == FAILED, we have no sense information;
+                * returning FAILED will wake the error handler thread
+                * to collect the sense and redo the decide
+                * disposition */
+               return rtn;
        case CONDITION_GOOD:
        case INTERMEDIATE_GOOD:
        case INTERMEDIATE_C_GOOD:
index 44d4d7542701e27aa11570bff55f4349006e577a..5ee88b47014ba62052d1613d5fc6aec17efe19d4 100644 (file)
@@ -265,7 +265,6 @@ static int scsi_init_cmd_errh(struct scsi_cmnd *cmd)
        cmd->serial_number = 0;
        cmd->serial_number_at_timeout = 0;
        cmd->flags = 0;
-       cmd->retries = 0;
        cmd->abort_reason = 0;
 
        memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer);