Commit f13e2201 authored by Gwendal Grignou's avatar Gwendal Grignou Committed by Tejun Heo

libata: make ata_eh_qc_retry() bump scmd->allowed on bogus failures

libata EH decrements scmd->retries when the command failed for reasons
unrelated to the command itself so that, for example, commands aborted
due to suspend / resume cycle don't get penalized; however,
decrementing scmd->retries isn't enough for ATA passthrough commands.

Without this fix, ATA passthrough commands are not resend to the
drive, and no error is signalled to the caller because:

- allowed retry count is 1
- ata_eh_qc_complete fill the sense data, so result is valid
- sense data is filled with untouched ATA registers.
Signed-off-by: default avatarGwendal Grignou <gwendal@google.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
parent 0fed4c09
...@@ -1322,14 +1322,14 @@ void ata_eh_qc_complete(struct ata_queued_cmd *qc) ...@@ -1322,14 +1322,14 @@ void ata_eh_qc_complete(struct ata_queued_cmd *qc)
* should be retried. To be used from EH. * should be retried. To be used from EH.
* *
* SCSI midlayer limits the number of retries to scmd->allowed. * SCSI midlayer limits the number of retries to scmd->allowed.
* scmd->retries is decremented for commands which get retried * scmd->allowed is incremented for commands which get retried
* due to unrelated failures (qc->err_mask is zero). * due to unrelated failures (qc->err_mask is zero).
*/ */
void ata_eh_qc_retry(struct ata_queued_cmd *qc) void ata_eh_qc_retry(struct ata_queued_cmd *qc)
{ {
struct scsi_cmnd *scmd = qc->scsicmd; struct scsi_cmnd *scmd = qc->scsicmd;
if (!qc->err_mask && scmd->retries) if (!qc->err_mask)
scmd->retries--; scmd->allowed++;
__ata_eh_qc_complete(qc); __ata_eh_qc_complete(qc);
} }
......
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