Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Igor Pylypiv <ipylypiv@google.com>
To: Niklas Cassel <cassel@kernel.org>
Cc: Damien Le Moal <dlemoal@kernel.org>, linux-ide@vger.kernel.org
Subject: Re: [PATCH] ata: libata-eh: Retry non-NCQ commands when their sense data asks for it
Date: Fri, 30 Oct 2026 11:21:18 -0700	[thread overview]
Message-ID: <auTgHptFA3dZBvcO@google.com> (raw)
In-Reply-To: <20261030090047.407906-2-cassel@kernel.org>

On Fri, Oct 30, 2026 at 10:00:48AM +0100, Niklas Cassel wrote:
> When a failed command has valid sense data, ata_eh_analyze_tf() asks
> scsi_check_sense() whether the command should be retried, and sets
> ATA_QCFLAG_RETRY if it should. ata_eh_link_autopsy() then clears
> AC_ERR_DEV and AC_ERR_OTHER from qc->err_mask, relying on that decision.
> 
> For an NCQ command, qc->err_mask still has AC_ERR_NCQ, so
> ata_eh_finish() honors ATA_QCFLAG_RETRY. For a non-NCQ command, whose
> sense data comes from REQUEST SENSE DATA EXT, qc->err_mask is now zero,
> and ata_eh_finish() completes the command with scmd->retries set to
> scmd->allowed, without looking at ATA_QCFLAG_RETRY. Such a command is
> thus never retried, even when its sense data asks for a retry, e.g. a
> transient error reported as ABORTED COMMAND.
> 
> Make ata_eh_finish() honor ATA_QCFLAG_RETRY for commands with valid
> sense data. ata_eh_qc_retry() cannot be used for this: as qc->err_mask
> is zero, it increments scmd->allowed, so every retry would allow one
> more, and a persistent error would be retried forever. Instead,
> complete the command without touching scmd->allowed or scmd->retries,
> so that the SCSI midlayer retries it at most scmd->allowed times, like
> any other failed command.
> 
> Fixes: 3852e3738266 ("libata: evaluate SCSI sense code")
> Signed-off-by: Niklas Cassel <cassel@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor

      reply	other threads:[~2026-10-30 18:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30  9:00 [PATCH] ata: libata-eh: Retry non-NCQ commands when their sense data asks for it Niklas Cassel
2026-10-30 18:21 ` Igor Pylypiv [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auTgHptFA3dZBvcO@google.com \
    --to=ipylypiv@google.com \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox