Commit 4f14b1c5 authored by James Bottomley's avatar James Bottomley

Fix loop problem in SCSI error handler sense collection

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).
parent 8396ce28
......@@ -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:
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment