Re: [git patches] libata updates for 2.6.37

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tejun Heo
Date: Wednesday, December 1, 2010 - 7:19 am

Hello, again.

On 12/01/2010 01:44 PM, Kyle McMartin wrote:
...

Nothing peculiar.  Hmm... okay, I think I've found what went wrong.
Can you please try the following patch and see whether the problem
goes away?

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 5e59050..17a6378 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3275,6 +3275,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
 	struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL;
 	struct ata_eh_context *ehc = &link->eh_context;
 	struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
+	enum ata_lpm_policy old_policy = link->lpm_policy;
 	unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM;
 	unsigned int err_mask;
 	int rc;
@@ -3338,6 +3339,14 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
 		goto fail;
 	}

+	/*
+	 * Low level driver acked the transition.  Issue DIPM command
+	 * with the new policy set.
+	 */
+	link->lpm_policy = policy;
+	if (ap && ap->slave_link)
+		ap->slave_link->lpm_policy = policy;
+
 	/* host config updated, enable DIPM if transitioning to MIN_POWER */
 	ata_for_each_dev(dev, link, ENABLED) {
 		if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) {
@@ -3353,12 +3362,14 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
 		}
 	}

-	link->lpm_policy = policy;
-	if (ap && ap->slave_link)
-		ap->slave_link->lpm_policy = policy;
 	return 0;

 fail:
+	/* restore the old policy */
+	link->lpm_policy = old_policy;
+	if (ap && ap->slave_link)
+		ap->slave_link->lpm_policy = old_policy;
+
 	/* if no device or only one more chance is left, disable LPM */
 	if (!dev || ehc->tries[dev->devno] <= 2) {
 		ata_link_printk(link, KERN_WARNING,
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[git patches] libata updates for 2.6.37, Jeff Garzik, (Thu Oct 21, 6:23 pm)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Mon Nov 29, 11:07 am)
Re: [git patches] libata updates for 2.6.37, Tejun Heo, (Tue Nov 30, 7:13 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Tue Nov 30, 8:38 am)
Re: [git patches] libata updates for 2.6.37, Tejun Heo, (Tue Nov 30, 9:29 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Tue Nov 30, 9:31 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Tue Nov 30, 10:53 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Tue Nov 30, 2:09 pm)
Re: [git patches] libata updates for 2.6.37, Tejun Heo, (Wed Dec 1, 4:17 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Wed Dec 1, 5:44 am)
Re: [git patches] libata updates for 2.6.37, Tejun Heo, (Wed Dec 1, 7:19 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Wed Dec 1, 8:50 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Wed Dec 1, 1:09 pm)
Re: [git patches] libata updates for 2.6.37, Tejun Heo, (Thu Dec 2, 3:17 am)
debug kernel using two laptops without serial port, Stanley Gan, (Thu Dec 2, 5:56 am)
Re: debug kernel using two laptops without serial port, Borislav Petkov, (Thu Dec 2, 6:17 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Thu Dec 2, 2:23 pm)
Re: [git patches] libata updates for 2.6.37, Tejun Heo, (Fri Dec 3, 3:10 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Fri Dec 3, 4:59 am)
Re: [git patches] libata updates for 2.6.37, Kyle McMartin, (Mon Dec 6, 9:07 am)
Re: [git patches] libata updates for 2.6.37, Tejun Heo, (Mon Dec 6, 10:46 am)