]> git.hungrycats.org Git - linux/commitdiff
libata: fix EH device failure handling
authorTejun Heo <tj@kernel.org>
Thu, 29 Jan 2009 11:31:29 +0000 (20:31 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Feb 2009 17:46:28 +0000 (09:46 -0800)
commit d89293abd95bfd7dd9229087d6c30c1464c5ac83 upstream.

The dev->pio_mode > XFER_PIO_0 test is there to avoid unnecessary
speed down warning messages but it accidentally disabled SATA link spd
down during configuration phase after reset where PIO mode is always
zero.

This patch fixes the problem by moving the test where it belongs.
This makes libata probing sequence behave better when the connection
is flaky at higher link speeds which isn't too uncommon for eSATA
devices.

[cebbert@redhat.com: trivial backport to 2.6.27]

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/ata/libata-eh.c

index 2c4ccecea691938979d4d9c155935816e9c67c32..154e7d6590841e76064151d0414055e65ab7a94a 100644 (file)
@@ -2694,12 +2694,13 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
                /* give it just one more chance */
                ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
        case -EIO:
-               if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) {
+               if (ehc->tries[dev->devno] == 1) {
                        /* This is the last chance, better to slow
                         * down than lose it.
                         */
                        sata_down_spd_limit(dev->link);
-                       ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
+                       if (dev->pio_mode > XFER_PIO_0)
+                               ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
                }
        }