Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=08cf69d005acda706bc014c61301993758ce9c5f
Commit:     08cf69d005acda706bc014c61301993758ce9c5f
Parent:     416dc9ed206bba09807300ee5f155a81cebbd4a1
Author:     Tejun Heo <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 31 10:17:04 2007 +0900
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Sat Nov 3 08:46:54 2007 -0400

    libata: more robust reset failure handling
    
    Reset failure is a critical error.  It results in disabling the link
    requiring user intervention to re-enable it.  Make reset failure
    handling more robust such that libata EH doesn't give up too early.
    
    * Temporary glitches during hardreset may lead to classification
      failure when there's no softreset available.  Retry instead of
      giving up.
    
    * Initial softreset or follow up softreset may fail classification.
      Move classification error handling block out of followup softreset
      block such that both cases are handled and retry instead of giving
      up.  Also, on the last try, give ATA class a blind shot.
    
    Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/libata-eh.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index dae2174..7a2e54e 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2184,25 +2184,32 @@ int ata_eh_reset(struct ata_link *link, int classify,
                                        "follow-up softreset required "
                                        "but no softreset avaliable\n");
                        rc = -EINVAL;
-                       goto out;
+                       goto fail;
                }
 
                ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK);
                rc = ata_do_reset(link, reset, classes, deadline);
-
-               if (rc == 0 && classify && classes[0] == ATA_DEV_UNKNOWN &&
-                   !(lflags & ATA_LFLAG_ASSUME_CLASS)) {
-                       ata_link_printk(link, KERN_ERR,
-                                       "classification failed\n");
-                       rc = -EINVAL;
-                       goto out;
-               }
        }
 
        /* -EAGAIN can happen if we skipped followup SRST */
        if (rc && rc != -EAGAIN)
                goto fail;
 
+       /* was classification successful? */
+       if (classify && classes[0] == ATA_DEV_UNKNOWN &&
+           !(lflags & ATA_LFLAG_ASSUME_CLASS)) {
+               if (try < max_tries) {
+                       ata_link_printk(link, KERN_WARNING,
+                                       "classification failed\n");
+                       rc = -EINVAL;
+                       goto fail;
+               }
+
+               ata_link_printk(link, KERN_WARNING,
+                               "classfication failed, assuming ATA\n");
+               lflags |= ATA_LFLAG_ASSUME_ATA;
+       }
+
        ata_link_for_each_dev(dev, link) {
                /* After the reset, the device state is PIO 0 and the
                 * controller state is undefined.  Reset also wakes up
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to