ata: libata-eh: Do not retry reset if the device is gone
PATCH 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_eh_reset() returns -ENODEV.
--- drivers/ata/libata-eh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-eh.c +1 -1
@@ -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
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 tomax_triestimes.Prevent unnecessary reset retries by exiting the loop early when
ata_eh_reset()returns-ENODEV.Signed-off-by Igor Pylypiv <[email protected]>
Looks good.
Signature · 2 lines
Damien Le Moal Western Digital Research
Niklas Cassel
maintainerQuoted 6 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 tomax_triestimes.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
Quoted 5 lines · Niklas Cassel
Quoted 4 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 tomax_triestimes.
Quoted 8 lines
Quoted 2 lines
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
Quoted 8 lines
I guess you could also write it like:
Prevent unnecessary reset retries by exiting the loop early when a callee inata_eh_reset()returns-ENODEV.Kind regards,
Niklas