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

Jason Yan <[email protected]> Fri, 10 Jul 2026 09:53:22 +0800
Newsgroups gmane.linux.scsi,gmane.linux.ide
Message-ID <[email protected]>
在 2026/7/10 8:06, Damien Le Moal 写道:
> If a command timeout occurs while we have a deferred non-NCQ command
> waiting to be issued, the scsi EH task is never 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
> scsi_error_handler() function test "shost->host_failed !=
> scsi_host_busy(shost))" to always be true, keeping the SCSI EH task
> sleeping. Eventually, when the deferred command also times out, the EH
> task is woken up and the timeout processing starts.
> 
> Avoid this unnecessary additional 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 helper function ata_scsi_port_eh_timed_out()
> if the device is a sata one.
> 
> 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           |  5 +++--
>   drivers/scsi/libsas/sas_scsi_host.c | 17 +++++++++++++++++
>   include/linux/libata.h              |  2 ++
>   include/scsi/libsas.h               |  2 ++
>   4 files changed, 24 insertions(+), 2 deletions(-)

Looks good to me,

Reviewed-by: Jason Yan <[email protected]>