linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Tim Blechmann <tim@klingt.org>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: 2.6.31-rc5 regression: hd don't show up
Date: Wed, 16 Sep 2009 14:39:08 +0900	[thread overview]
Message-ID: <4AB079FC.6000906@kernel.org> (raw)
In-Reply-To: <4AB04B39.7030907@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

Hello,

Can you please try the attached patch and report the result?  The bug
shouldn't happen now and for cases where it would have happened,
libata will report "link online but device misclassified" and retry.

Thanks.

-- 
tejun

[-- Attachment #2: fix-link-onoffline-handling.patch --]
[-- Type: text/x-patch, Size: 3437 bytes --]

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index a04488f..1f0fd67 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1016,8 +1016,8 @@ int ata_port_freeze(struct ata_port *ap)
 
 	WARN_ON(!ap->ops->error_handler);
 
-	__ata_port_freeze(ap);
 	nr_aborted = ata_port_abort(ap);
+	__ata_port_freeze(ap);
 
 	return nr_aborted;
 }
@@ -2667,14 +2667,14 @@ int ata_eh_reset(struct ata_link *link, int classify,
 		dev->pio_mode = XFER_PIO_0;
 		dev->flags &= ~ATA_DFLAG_SLEEPING;
 
-		if (!ata_phys_link_offline(ata_dev_phys_link(dev))) {
-			/* apply class override */
-			if (lflags & ATA_LFLAG_ASSUME_ATA)
-				classes[dev->devno] = ATA_DEV_ATA;
-			else if (lflags & ATA_LFLAG_ASSUME_SEMB)
-				classes[dev->devno] = ATA_DEV_SEMB_UNSUP;
-		} else
-			classes[dev->devno] = ATA_DEV_NONE;
+		if (ata_phys_link_offline(ata_dev_phys_link(dev)))
+			continue;
+
+		/* apply class override */
+		if (lflags & ATA_LFLAG_ASSUME_ATA)
+			classes[dev->devno] = ATA_DEV_ATA;
+		else if (lflags & ATA_LFLAG_ASSUME_SEMB)
+			classes[dev->devno] = ATA_DEV_SEMB_UNSUP;
 	}
 
 	/* record current link speed */
@@ -2713,34 +2713,48 @@ int ata_eh_reset(struct ata_link *link, int classify,
 	ap->pflags &= ~ATA_PFLAG_EH_PENDING;
 	spin_unlock_irqrestore(link->ap->lock, flags);
 
-	/* Make sure onlineness and classification result correspond.
+	/*
+	 * Make sure onlineness and classification result correspond.
 	 * Hotplug could have happened during reset and some
 	 * controllers fail to wait while a drive is spinning up after
 	 * being hotplugged causing misdetection.  By cross checking
-	 * link onlineness and classification result, those conditions
-	 * can be reliably detected and retried.
+	 * link on/offlineness and classification result, those
+	 * conditions can be reliably detected and retried.
 	 */
 	nr_unknown = 0;
 	ata_for_each_dev(dev, link, ALL) {
-		/* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */
-		if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
-			classes[dev->devno] = ATA_DEV_NONE;
-			if (ata_phys_link_online(ata_dev_phys_link(dev)))
+		if (ata_phys_link_online(ata_dev_phys_link(dev))) {
+			if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
+				ata_dev_printk(dev, KERN_DEBUG, "link online "
+					       "but device misclassifed\n");
+				classes[dev->devno] = ATA_DEV_NONE;
 				nr_unknown++;
+			}
+		} else if (ata_phys_link_offline(ata_dev_phys_link(dev))) {
+			if (ata_class_enabled(classes[dev->devno]))
+				ata_dev_printk(dev, KERN_DEBUG, "link offline, "
+					       "clearing class %d to NONE\n",
+					       classes[dev->devno]);
+			classes[dev->devno] = ATA_DEV_NONE;
+		} else if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
+			ata_dev_printk(dev, KERN_DEBUG, "link status unknown, "
+				       "clearing UNKNOWN to NONE\n");
+			classes[dev->devno] = ATA_DEV_NONE;
 		}
 	}
 
 	if (classify && nr_unknown) {
 		if (try < max_tries) {
 			ata_link_printk(link, KERN_WARNING, "link online but "
-				       "device misclassified, retrying\n");
+					"%d devices misclassified, retrying\n",
+					nr_unknown);
 			failed_link = link;
 			rc = -EAGAIN;
 			goto fail;
 		}
 		ata_link_printk(link, KERN_WARNING,
-			       "link online but device misclassified, "
-			       "device detection might fail\n");
+				"link online but %d devices misclassified, "
+				"device detection might fail\n", nr_unknown);
 	}
 
 	/* reset successful, schedule revalidation */

  reply	other threads:[~2009-09-16  5:39 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-14  8:26 2.6.31-rc5 regression: hd don't show up Tim Blechmann
2009-08-14  9:17 ` Tejun Heo
2009-08-14 12:34   ` Tim Blechmann
2009-08-16  2:54     ` Tejun Heo
2009-08-16 10:05       ` Tim Blechmann
2009-08-27  8:38         ` Tejun Heo
2009-08-27 10:21           ` Tim Blechmann
2009-08-27 11:35             ` Tejun Heo
2009-08-28 11:04               ` Tim Blechmann
2009-08-31  7:39                 ` Tejun Heo
2009-09-01 23:34                   ` Tim Blechmann
2009-09-02  2:22                     ` Tejun Heo
2009-09-02  9:12                       ` Tim Blechmann
2009-09-03 14:07                         ` Tejun Heo
2009-09-04 22:06                           ` Tim Blechmann
2009-09-04 22:33                             ` Maxim Levitsky
2009-09-05  0:12                             ` Tejun Heo
2009-09-08 20:58                               ` Tim Blechmann
2009-09-16  2:19                                 ` Tejun Heo
2009-09-16  5:39                                   ` Tejun Heo [this message]
2009-09-16  7:36                                     ` Tim Blechmann
2009-09-16 12:00                                       ` Tejun Heo
2009-09-25  4:20                                         ` Tejun Heo
2009-09-25  7:46                                           ` Tim Blechmann
2009-09-25  7:53                                             ` Tejun Heo
2009-09-25 11:47                                               ` Tim Blechmann
2009-09-25 13:21                                                 ` Tejun Heo
2009-10-02  5:20                                                   ` Tejun Heo
2009-10-02  7:30                                                     ` Tim Blechmann
2009-10-02  8:59                                                       ` Tejun Heo
2009-10-05  9:59                                                         ` Tim Blechmann
2009-10-06  7:30                                                           ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AB079FC.6000906@kernel.org \
    --to=tj@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim@klingt.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).