]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
libata: skip old error history when counting probe trials
authorLin Ming <ming.m.lin@intel.com>
Thu, 3 May 2012 14:15:07 +0000 (22:15 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 11 May 2012 12:14:52 +0000 (13:14 +0100)
commit 6868225e3e92399068be9a5f1635752d91012ad5 upstream.

Commit d902747("[libata] Add ATA transport class") introduced
ATA_EFLAG_OLD_ER to mark entries in the error ring as cleared.

But ata_count_probe_trials_cb() didn't check this flag and it still
counts the old error history. So wrong probe trials count is returned
and it causes problem, for example, SATA link speed is slowed down from
3.0Gbps to 1.5Gbps.

Fix it by checking ATA_EFLAG_OLD_ER in ata_count_probe_trials_cb().

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/ata/libata-eh.c

index a9b282038000c921eca51f7484866d890dec5d54..58db8344d04d9faf5527f50bac986ce9888e5902 100644 (file)
@@ -3500,7 +3500,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg
        u64 now = get_jiffies_64();
        int *trials = void_arg;
 
-       if (ent->timestamp < now - min(now, interval))
+       if ((ent->eflags & ATA_EFLAG_OLD_ER) ||
+           (ent->timestamp < now - min(now, interval)))
                return -1;
 
        (*trials)++;