Re: [PATCH v5 2/2] scsi: libsas: terminate deferred commands on time out

Hannes Reinecke <[email protected]> Thu, 16 Jul 2026 15:47:07 +0200
Newsgroups org.kernel.vger.linux-ide,org.kernel.vger.linux-scsi
Message-ID <[email protected]>
On 7/16/26 10:38 AM, Damien Le Moal wrote:
> If a command timeout occurs while we have a deferred non-NCQ command
> waiting to be issued, the SCSI EH task is not immediately woken up as the
> waiting deferred command is never issued nor completed, thus leaving this
> command to always be counted as "busy" for the SCSI host. This results in
> the test "shost->host_failed != scsi_host_busy(shost))" in the function
> scsi_error_handler() to always be true, keeping the EH task sleeping.
> Eventually, when the deferred command also times out, the SCSI EH task
> is woken up and the timeout processing occurs.
> 
> Avoid this unnecessary additional SCSI EH trigger wait time with the same
> method as implemented in libata-scsi, using the eh_timed_out SCSI host
> template operation. The function sas_eh_timed_out() implements this
> operation and executes the function ata_scsi_retry_deferred_qc()
> for SATA devices.
> 
> Co-developed-by: Igor Pylypiv <[email protected]>
> Signed-off-by: Igor Pylypiv <[email protected]>
> Fixes: 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ command starvation")
> Cc: [email protected]
> Signed-off-by: Damien Le Moal <[email protected]>
> ---
>   drivers/ata/libata-scsi.c           |  4 ++--
>   drivers/scsi/libsas/sas_scsi_host.c | 15 +++++++++++++++
>   include/linux/libata.h              |  1 +
>   include/scsi/libsas.h               |  2 ++
>   4 files changed, 20 insertions(+), 2 deletions(-)
> 
Reviewed-by: Hannes Reinecke <[email protected]>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich