Skip to contentSkip to conversation

ata: libata-eh: Do not retry reset if the device is gone

PATCH Applied Igor Pylypiv 2 participants 2 messages Apr 2 libata

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ata: libata-eh: Do not retry reset if the device is gone

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.

---

Changes from v1:
- Corrected the commit message to reference ata_do_reset() instead of ata_eh_reset() for the early loop break.

drivers/ata/libata-eh.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-eh.c +1 -1
index 23be85418b3b..e97a842005e9 100644
@@ -3171,7 +3171,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
Signature · 1 line
2.53.0.1185.g05d4b7b318-goog
maintainer Applied
#1 lore raw
Quoted 8 lines · Igor Pylypiv

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.

[...]

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

[1/1] ata: libata-eh: Do not retry reset if the device is gone

      https://git.kernel.org/libata/linux/c/182caa17

Kind regards,
Niklas