Skip to contentSkip to conversation

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

PATCH In review Gwendal Grignou 2 participants 14 messages Aug 6, 2009 – Oct 7, 2013 libata

lore
Share & tools
lore
#0 lore raw

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

---
 drivers/ata/libata-core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/ata/libata-core.c +2 -0
index 8ac98ff..5b7616d 100644
@@ -5145,6 +5145,8 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
 	/* if device is sleeping, schedule reset and abort the link */
 	if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
 		link->eh_info.action |= ATA_EH_RESET;
+		if (qc->scsicmd) 
+			qc->scsicmd->allowed++;
 		ata_ehi_push_desc(&link->eh_info, "waking up from sleep");
 		ata_link_abort(link);
 		return;
Signature · 1 line
1.5.4.3
#1 lore raw

The explanation did not go through git-send-email:

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.

Gwendal.

Quoted 23 lines · Gwendal Grignou

---
 drivers/ata/libata-core.c |    2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/ata/libata-core.c +2 -1
index 8ac98ff..5b7616d 100644
@@ -5145,6 +5145,8 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
        /* if device is sleeping, schedule reset and abort the link */
        if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
                link->eh_info.action |= ATA_EH_RESET;
+               if (qc->scsicmd)
+                       qc->scsicmd->allowed++;
                ata_ehi_push_desc(&link->eh_info, "waking up from sleep");
                ata_link_abort(link);
                return;
--

1.5.4.3

#2 lore raw
Quoted 8 lines · Gwendal Grignou

The explanation did not go through git-send-email:

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.

Would setting ATA_QCFLAG_RETRY achieve the same result?

Thanks.

Signature · 1 line
tejun
#3 lore raw

ATA_QCFLAG_RETRY is already set [by _autopsy()], ata_eh_qc_retry() was already called, but given retries is 0, we can not reduce it. However, I will submit a better patch, in ata_eh_qc_retry().

Gwendal.

Quoted 8 lines · Tejun Heo
Quoted 7 lines · Gwendal Grignou

The explanation did not go through git-send-email:

 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

My mistake: __ata_eh_qc_complete() instead of ata_eh_qc_complete().

Quoted 9 lines
Quoted 1 line

 - sense data is filled with untouched ATA registers.

Would setting ATA_QCFLAG_RETRY achieve the same result?

Thanks.

--
tejun

#4 lore raw

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

---
 drivers/ata/libata-eh.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/ata/libata-eh.c +3 -3
index 79711b6..202da9c 100644
@@ -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);
 }
 
Signature · 1 line
1.5.4.3
Acked-by on v1 1/1
#5 lore raw
Quoted 3 lines · Gwendal Grignou
---
 drivers/ata/libata-eh.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

The patch description is missing again but other than that

Signature · 1 line
tejun
#6 lore raw

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

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(-)
drivers/ata/libata-eh.c +3 -3
index 79711b6..202da9c 100644
@@ -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);
 }
 
Signature · 1 line
1.5.4.3
#7 lore raw
Quoted 1 line · Gwendal Grignou

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

80 column.

Quoted 4 lines

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.

Signature · 1 line
tejun
#8 lore raw

PATCH 1/1 When a disk wakes up from sleep, ensure that the command is retried by SCSI EH.

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(-)
drivers/ata/libata-eh.c +3 -3
index 79711b6..202da9c 100644
@@ -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);
 }
 
Signature · 1 line
1.5.4.3
Acked-by on v1 1/1
#9 lore raw

Re: [PATCH] When a disk wakes up from sleep, ensure that the command is retried by SCSI EH.

Quoted 7 lines · Gwendal Grignou

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.

Signature · 1 line
tejun
#10 lore raw

Re: [PATCH] When a disk wakes up from sleep, ensure that the command is retried by SCSI EH.

Just looking into 2.6.33 code, and I did not find this patch. Is there anything I should do to have it merge?

Thanks,
Gwendal.

Quoted 14 lines · Tejun Heo
Quoted 7 lines · Gwendal Grignou

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.

--
tejun

#11 lore raw

Re: [PATCH] When a disk wakes up from sleep, ensure that the command is retried by SCSI EH.

Hello,

Quoted 2 lines · Gwendal Grignou

Just looking into 2.6.33 code, and I did not find this patch. Is there anything I should do to have it merge?

I think Jeff just hasn't come around yet. Please wait a bit more for Jeff's "applied" mail. If it doesn't happen in a week or so, pinging him again would be a good idea.

Signature · 1 line
tejun
#12 lore raw

Re: [PATCH] When a disk wakes up from sleep, ensure that the command is retried by SCSI EH.

Quoted 11 lines · Tejun Heo <tj <at> kernel.org> writes:

Hello,

Quoted 2 lines · Gwendal Grignou

Just looking into 2.6.33 code, and I did not find this patch. Is there anything I should do to have it merge?

I think Jeff just hasn't come around yet. Please wait a bit more for Jeff's "applied" mail. If it doesn't happen in a week or so, pinging him again would be a good idea.

Ping, years later! The patch still applies to 3.12.0-rc3.

Gwendal.

Applied
#13 lore raw

Re: [PATCH] When a disk wakes up from sleep, ensure that the command ?is retried by SCSI EH.

Hello, Gwendal.

Applied to libata/for-3.12-fixes w/ commit message updated and stable cc'd.

Thanks.

Quoted 1 line

From f13e220161e738c2710b9904dcb3cf8bb0bcce61 Mon Sep 17 00:00:00 2001

From: Gwendal Grignou <[email protected]>
Date: Fri, 7 Aug 2009 16:17:49 -0700
Subject: [PATCH] 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.

---
 drivers/ata/libata-eh.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ata/libata-eh.c +3 -3
index c69fcce..370462f 100644
@@ -1322,14 +1322,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);
 }
 
Signature · 1 line
1.8.3.1