libata: clear eh_info on reset completion
authorTejun Heo <tj@kernel.org>
Fri, 17 Jul 2009 02:58:33 +0000 (11:58 +0900)
committerJeff Garzik <jgarzik@redhat.com>
Tue, 1 Sep 2009 23:47:19 +0000 (19:47 -0400)
Resets are done with port frozen but some controllers still issue
interrupts during reset and they may end up recording error conditions
in ehi leading to unnecessary EH retrials.

This patch makes ata_eh_reset() clear ehi on reset completion.  As
reset is the most severe recovery action, there's nothing to lose by
clearing ehi on its completion.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Zdenek Kaspar <zkaspar82@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/libata-eh.c

index 9159abe5211cfa6d04a213fb453aa85d464a7903..2c34de841e110c1903f6e3d4b40d693ef08fe2d6 100644 (file)
@@ -2576,11 +2576,17 @@ int ata_eh_reset(struct ata_link *link, int classify,
                        postreset(slave, classes);
        }
 
-       /* clear cached SError */
+       /*
+        * Some controllers can't be frozen very well and may set
+        * spuruious error conditions during reset.  Clear accumulated
+        * error information.  As reset is the final recovery action,
+        * nothing is lost by doing this.
+        */
        spin_lock_irqsave(link->ap->lock, flags);
-       link->eh_info.serror = 0;
+       memset(&link->eh_info, 0, sizeof(link->eh_info));
        if (slave)
-               slave->eh_info.serror = 0;
+               memset(&slave->eh_info, 0, sizeof(link->eh_info));
+       ap->pflags &= ~ATA_PFLAG_EH_PENDING;
        spin_unlock_irqrestore(link->ap->lock, flags);
 
        /* Make sure onlineness and classification result correspond.