Patchwork [#upstream-fixes] libata: fix hotplug for drivers which don't implement LPM

login
register
mail settings
Submitter Tejun Heo
Date Feb. 24, 2011, 6:30 p.m.
Message ID <20110224183037.GS7840@htj.dyndns.org>
Download mbox | patch
Permalink /patch/84428/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Tejun Heo - Feb. 24, 2011, 6:30 p.m.
ata_eh_analyze_serror() suppresses hotplug notifications if LPM is
being used because LPM generates spurious hotplug events.  It compared
whether link->lpm_policy was different from ATA_LPM_MAX_POWER to
determine whether LPM is enabled; however, this is incorrect as for
drivers which don't implement LPM, lpm_policy is always
ATA_LPM_UNKNOWN.  This disabled hotplug detection for all drivers
which don't implement LPM.

Fix it by comparing whether lpm_policy is greater than
ATA_LPM_MAX_POWER.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@kernel.org
---
 drivers/ata/libata-eh.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Garzik - March 2, 2011, 7:45 a.m.
On 02/24/2011 01:30 PM, Tejun Heo wrote:
> ata_eh_analyze_serror() suppresses hotplug notifications if LPM is
> being used because LPM generates spurious hotplug events.  It compared
> whether link->lpm_policy was different from ATA_LPM_MAX_POWER to
> determine whether LPM is enabled; however, this is incorrect as for
> drivers which don't implement LPM, lpm_policy is always
> ATA_LPM_UNKNOWN.  This disabled hotplug detection for all drivers
> which don't implement LPM.
>
> Fix it by comparing whether lpm_policy is greater than
> ATA_LPM_MAX_POWER.
>
> Signed-off-by: Tejun Heo<tj@kernel.org>
> Cc: stable@kernel.org

applied, though putting this into 2.6.38.1 is preferred to changing this 
at -rc7...  stable@ cc'd.

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tejun Heo - March 2, 2011, 7:47 a.m.
On Wed, Mar 02, 2011 at 02:45:17AM -0500, Jeff Garzik wrote:
> On 02/24/2011 01:30 PM, Tejun Heo wrote:
> >ata_eh_analyze_serror() suppresses hotplug notifications if LPM is
> >being used because LPM generates spurious hotplug events.  It compared
> >whether link->lpm_policy was different from ATA_LPM_MAX_POWER to
> >determine whether LPM is enabled; however, this is incorrect as for
> >drivers which don't implement LPM, lpm_policy is always
> >ATA_LPM_UNKNOWN.  This disabled hotplug detection for all drivers
> >which don't implement LPM.
> >
> >Fix it by comparing whether lpm_policy is greater than
> >ATA_LPM_MAX_POWER.
> >
> >Signed-off-by: Tejun Heo<tj@kernel.org>
> >Cc: stable@kernel.org
> 
> applied, though putting this into 2.6.38.1 is preferred to changing
> this at -rc7...  stable@ cc'd.

Understood.  As long as it ends up in stable@, either way is okay with
me.  Thank you.

Patch

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 17a6378..e16850e 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1618,7 +1618,7 @@  static void ata_eh_analyze_serror(struct ata_link *link)
 	 * host links.  For disabled PMP links, only N bit is
 	 * considered as X bit is left at 1 for link plugging.
 	 */
-	if (link->lpm_policy != ATA_LPM_MAX_POWER)
+	if (link->lpm_policy > ATA_LPM_MAX_POWER)
 		hotplug_mask = 0;	/* hotplug doesn't work w/ LPM */
 	else if (!(link->flags & ATA_LFLAG_DISABLED) || ata_is_host_link(link))
 		hotplug_mask = SERR_PHYRDY_CHG | SERR_DEV_XCHG;