Skip to content

Commit 54d7211

Browse files
committed
ata: libata-eh: Spinup disk on resume after revalidation
Move the call to ata_dev_power_set_active() to transition a disk in standby power mode to the active power mode from ata_eh_revalidate_and_attach() before doing revalidation to the end of ata_eh_recover(), after the link speed for the device is reconfigured (if that was necessary). This is safer as this ensure that the VERIFY command executed to spinup the disk is executed with the drive properly reconfigured first. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 0e7ad4b commit 54d7211

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

drivers/ata/libata-eh.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3051,15 +3051,6 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
30513051
if (ehc->i.flags & ATA_EHI_DID_RESET)
30523052
readid_flags |= ATA_READID_POSTRESET;
30533053

3054-
/*
3055-
* When resuming, before executing any command, make sure to
3056-
* transition the device to the active power mode.
3057-
*/
3058-
if ((action & ATA_EH_SET_ACTIVE) && ata_dev_enabled(dev)) {
3059-
ata_dev_power_set_active(dev);
3060-
ata_eh_done(link, dev, ATA_EH_SET_ACTIVE);
3061-
}
3062-
30633054
if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) {
30643055
WARN_ON(dev->class == ATA_DEV_PMP);
30653056

@@ -3856,6 +3847,17 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
38563847
}
38573848
}
38583849

3850+
/*
3851+
* Make sure to transition devices to the active power mode
3852+
* if needed (e.g. if we were scheduled on system resume).
3853+
*/
3854+
ata_for_each_dev(dev, link, ENABLED) {
3855+
if (ehc->i.dev_action[dev->devno] & ATA_EH_SET_ACTIVE) {
3856+
ata_dev_power_set_active(dev);
3857+
ata_eh_done(link, dev, ATA_EH_SET_ACTIVE);
3858+
}
3859+
}
3860+
38593861
/* retry flush if necessary */
38603862
ata_for_each_dev(dev, link, ALL) {
38613863
if (dev->class != ATA_DEV_ATA &&

0 commit comments

Comments
 (0)