* [PATCH] ata: libata-eh: Do not retry reset if the device is gone
@ 2026-04-02 1:11 Igor Pylypiv
2026-04-02 5:25 ` Damien Le Moal
2026-04-02 8:55 ` Niklas Cassel
0 siblings, 2 replies; 4+ messages in thread
From: Igor Pylypiv @ 2026-04-02 1:11 UTC (permalink / raw)
To: Damien Le Moal, Niklas Cassel; +Cc: linux-ide, linux-kernel, 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_eh_reset() returns -ENODEV.
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
drivers/ata/libata-eh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 23be85418b3b..e97a842005e9 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -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
--
2.53.0.1185.g05d4b7b318-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ata: libata-eh: Do not retry reset if the device is gone
2026-04-02 1:11 [PATCH] ata: libata-eh: Do not retry reset if the device is gone Igor Pylypiv
@ 2026-04-02 5:25 ` Damien Le Moal
2026-04-02 8:55 ` Niklas Cassel
1 sibling, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2026-04-02 5:25 UTC (permalink / raw)
To: Igor Pylypiv, Niklas Cassel; +Cc: linux-ide, linux-kernel
On 2026/04/02 10:11, Igor Pylypiv wrote:
> 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_eh_reset() returns -ENODEV.
>
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ata: libata-eh: Do not retry reset if the device is gone
2026-04-02 1:11 [PATCH] ata: libata-eh: Do not retry reset if the device is gone Igor Pylypiv
2026-04-02 5:25 ` Damien Le Moal
@ 2026-04-02 8:55 ` Niklas Cassel
2026-04-02 15:34 ` Igor Pylypiv
1 sibling, 1 reply; 4+ messages in thread
From: Niklas Cassel @ 2026-04-02 8:55 UTC (permalink / raw)
To: Igor Pylypiv; +Cc: Damien Le Moal, linux-ide, linux-kernel
On Wed, Apr 01, 2026 at 06:11:01PM -0700, Igor Pylypiv wrote:
> 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_eh_reset() returns -ENODEV.
ata_do_reset() ?
The loop is inside ata_eh_reset(), so it sounds a bit weird to exit
the loop early if the function itself returns -ENODEV.
I guess you could also write it like:
Prevent unnecessary reset retries by exiting the loop early when
a callee in ata_eh_reset() returns -ENODEV.
Kind regards,
Niklas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ata: libata-eh: Do not retry reset if the device is gone
2026-04-02 8:55 ` Niklas Cassel
@ 2026-04-02 15:34 ` Igor Pylypiv
0 siblings, 0 replies; 4+ messages in thread
From: Igor Pylypiv @ 2026-04-02 15:34 UTC (permalink / raw)
To: Niklas Cassel; +Cc: Damien Le Moal, linux-ide, linux-kernel
On Thu, Apr 02, 2026 at 10:55:41AM +0200, Niklas Cassel wrote:
> On Wed, Apr 01, 2026 at 06:11:01PM -0700, Igor Pylypiv wrote:
> > 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_eh_reset() returns -ENODEV.
>
> ata_do_reset() ?
>
> The loop is inside ata_eh_reset(), so it sounds a bit weird to exit
> the loop early if the function itself returns -ENODEV.
>
Thank you for catching this, Niklas!
Yes, it should be ata_do_reset(). I'll send a V2 to fix the function name.
Thanks,
Igor
>
> I guess you could also write it like:
> Prevent unnecessary reset retries by exiting the loop early when
> a callee in ata_eh_reset() returns -ENODEV.
>
>
> Kind regards,
> Niklas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-02 15:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 1:11 [PATCH] ata: libata-eh: Do not retry reset if the device is gone Igor Pylypiv
2026-04-02 5:25 ` Damien Le Moal
2026-04-02 8:55 ` Niklas Cassel
2026-04-02 15:34 ` Igor Pylypiv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox