Patchwork When a disk needs to be waken up from sleep, ensure that the command is retried by SCSI EH.

login
register
mail settings
Submitter Gwendal Grignou
Date Aug. 7, 2009, 11:06 p.m.
Message ID <1249686403-29742-1-git-send-email-gwendal@google.com>
Download mbox | patch
Permalink /patch/30990/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Gwendal Grignou - Aug. 7, 2009, 11:06 p.m.
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.

---
 drivers/ata/libata-eh.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Tejun Heo - Aug. 7, 2009, 11:12 p.m.
Gwendal Grignou wrote:
>  Without this fix, ATA passthrough commands are not resend to the drive, and no error is

80 column.

>  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.

and Signed-off-by:

Thanks.

Patch

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 79711b6..202da9c 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1183,14 +1183,14 @@  void ata_eh_qc_complete(struct ata_queued_cmd *qc)
  *	should be retried.  To be used from EH.
  *
  *	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).
  */
 void ata_eh_qc_retry(struct ata_queued_cmd *qc)
 {
 	struct scsi_cmnd *scmd = qc->scsicmd;
-	if (!qc->err_mask && scmd->retries)
-		scmd->retries--;
+	if (!qc->err_mask)
+		scmd->allowed++;
 	__ata_eh_qc_complete(qc);
 }