rpms/kernel/F-11 libata-fix-incorrect-link-online-check-during-probe.patch, NONE, 1.1 kernel.spec, 1.1762, 1.1763

Chuck Ebbert cebbert at fedoraproject.org
Tue Oct 13 12:52:02 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25548

Modified Files:
	kernel.spec 
Added Files:
	libata-fix-incorrect-link-online-check-during-probe.patch 
Log Message:
Copy libata drive detection fix from 2.6.31.4 (#524756)

libata-fix-incorrect-link-online-check-during-probe.patch:
 libata-eh.c |   50 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 18 deletions(-)

--- NEW FILE libata-fix-incorrect-link-online-check-during-probe.patch ---
>From 3b761d3d437cffcaf160a5d37eb6b3b186e491d5 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj at kernel.org>
Date: Tue, 6 Oct 2009 17:08:40 +0900
Subject: libata: fix incorrect link online check during probe

From: Tejun Heo <tj at kernel.org>

commit 3b761d3d437cffcaf160a5d37eb6b3b186e491d5 upstream.

While trying to work around spurious detection retries for
non-existent devices on slave links, commit
816ab89782ac139a8b65147cca990822bb7e8675 incorrectly added link
offline check logic before ata_eh_thaw() was called.  This means that
if an occupied link goes down briefly at the time that offline check
was performed, device class will be cleared to ATA_DEV_NONE and libata
wouldn't retry thus failing detection of the device.

The offline check should be done after the port is thawed together
with online check so that such link glitches can be detected by the
interrupt handler and handled properly.

Signed-off-by: Tejun Heo <tj at kernel.org>
Reported-by: Tim Blechmann <tim at klingt.org>
Signed-off-by: Jeff Garzik <jgarzik at redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

---
 drivers/ata/libata-eh.c |   50 ++++++++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 18 deletions(-)

--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2541,14 +2541,14 @@ int ata_eh_reset(struct ata_link *link, 
 		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 */
@@ -2581,34 +2581,48 @@ int ata_eh_reset(struct ata_link *link, 
 		slave->eh_info.serror = 0;
 	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 */


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1762
retrieving revision 1.1763
diff -u -p -r1.1762 -r1.1763
--- kernel.spec	13 Oct 2009 10:26:00 -0000	1.1762
+++ kernel.spec	13 Oct 2009 12:52:02 -0000	1.1763
@@ -797,6 +797,9 @@ Patch15740: smsc95xx-fix-transmission-wh
 Patch15750: tcp-fix-config_tcp_md5sig-config_preempt-timer-bug.patch
 Patch15760: x86-fix-csum_ipv6_magic-asm-memory-clobber.patch
 
+# libata fix from 2.6.31.4 (#524756)
+Patch15800: libata-fix-incorrect-link-online-check-during-probe.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1491,6 +1494,9 @@ ApplyPatch smsc95xx-fix-transmission-whe
 ApplyPatch tcp-fix-config_tcp_md5sig-config_preempt-timer-bug.patch
 ApplyPatch x86-fix-csum_ipv6_magic-asm-memory-clobber.patch
 
+# libata fix from 2.6.31.4 (#524756)
+ApplyPatch libata-fix-incorrect-link-online-check-during-probe.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2079,6 +2085,9 @@ fi
 # and build.
 
 %changelog
+* Tue Oct 13 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.30.9-84
+- Copy libata drive detection fix from 2.6.31.4 (#524756)
+
 * Tue Oct 13 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.30.9-83
 - Networking fixes taken from 2.6.31-stable
 




More information about the fedora-extras-commits mailing list