Re: [PATCH v2 1/2] ata: libata-scsi: terminate deferred commands on time out

Niklas Cassel <[email protected]> Fri, 10 Jul 2026 10:48:35 +0200
Newsgroups gmane.linux.ide,gmane.linux.scsi
Message-ID <alCx41Qlh4TStKmB@fedora>
On Fri, Jul 10, 2026 at 05:29:56PM +0900, Damien Le Moal wrote:
> On 7/10/26 17:06, Niklas Cassel wrote:
> 
> Yes, it seems that nothing blocks new commands until scsi_eh_scmd_add() as that
> is the function setting the host state to recovery.
> 
> So back to the drawing board. A simple requeue will not cut it.
> 

My thinking is that if we set ATA_QCFLAG_RETRY and call
ata_qc_schedule_eh(qc, ...).

We should end up in:
https://github.com/torvalds/linux/blob/v7.2-rc2/drivers/ata/libata-eh.c#L4075-L4082

And this function will only run from EH itself, so obviously new
command will be blocked at this time.

And, if EH itself requeues the command, there should not be any
race between scsi_timeout() and scsi_complete() (since scsi_timeout()
will only add the command to the list of failed commands if SCMD_STATE_COMPLETE
is not set).


Kind regards,
Niklas