Re: [PATCH] ata: libata-eh: Fix detection of deferred qc timeouts

From: Guenter Roeck

Date: Fri Mar 06 2026 - 10:41:02 EST


On 3/6/26 01:05, Niklas Cassel wrote:
On Thu, Mar 05, 2026 at 06:48:05PM -0800, Guenter Roeck wrote:
If the `ata_qc_for_each_raw()` loop finishes without finding a matching
`scmd`, `qc` will hold a pointer to the last element examined, which is
accociated with `i == ATA_MAX_QUEUE - 1`. This element can match
`ap->deferred_qc`. If that happens, the condition `qc == ap->deferred_qc`
evaluates to true despite the loop not breaking on a scmd match.
In that case, the error handler mistakenly intercepts a command that
completed normally after an unrelated SCSI timeout, returning a timeout
error instead of success.

[...]

Applied commit log changes from Damien and myself.


Applied to libata/linux.git (libata-for-7.0-fixes), thanks!


Thanks!

Guenter