]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ata: libata-eh: Do not retry reset if the device is gone
authorIgor Pylypiv <ipylypiv@google.com>
Thu, 2 Apr 2026 16:07:05 +0000 (09:07 -0700)
committerNiklas Cassel <cassel@kernel.org>
Thu, 2 Apr 2026 18:18:29 +0000 (20:18 +0200)
If a device is hot-unplugged or otherwise disappears during error handling,
ata_eh_reset() may fail with -ENODEV. Currently, the error handler will
continue to retry the reset operation up to max_tries times.

Prevent unnecessary reset retries by exiting the loop early when
ata_do_reset() returns -ENODEV.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
drivers/ata/libata-eh.c

index bb0813ea8b1804003d783f798ae82368a2386106..9a4b67b90b17b665382cca2d04c73d533426a5ce 100644 (file)
@@ -3181,7 +3181,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
            sata_scr_read(link, SCR_STATUS, &sstatus))
                rc = -ERESTART;
 
-       if (try >= max_tries) {
+       if (try >= max_tries || rc == -ENODEV) {
                /*
                 * Thaw host port even if reset failed, so that the port
                 * can be retried on the next phy event.  This risks