Re: sata_mv port lockup on hotplug (kernel 2.6.38.2)

From: Tejun Heo
Date: Tue Sep 06 2011 - 12:34:13 EST


Hello,

On Tue, Sep 06, 2011 at 01:19:44PM +0100, Bruce Stenning wrote:
> ata4: EH complete
> Waking error handler thread
> scsi_eh_wakeup: succeeded
> scsi_schedule_eh: succeeded
> scsi_restart_operations: waking up host to restart
> Error handler scsi_eh_3 sleeping

I think the following should fix the problem. The code there is from
the time when libata shared scsi_host->host_lock. libata no longer
does that so, in the current state, host_eh_scheduled can be cleared
with actual pending EH condition.

You should be able to reproduce the problem more easily by adding
delay (something like mdelay(5)) before host_eh_scheduled clearing
without the following patch applied.

Thanks.

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index ed16fbe..e971784 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -771,6 +771,14 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
/* process port suspend request */
ata_eh_handle_port_suspend(ap);

+ /*
+ * Single iteration complete. Clear SCSI EH scheduled
+ * state and check whether another iteration is necessary.
+ */
+ spin_lock_irqsave(host->host_lock, flags);
+ host->host_eh_scheduled = 0;
+ spin_unlock_irqrestore(host->host_lock, flags);
+
/* Exception might have happened after ->error_handler
* recovered the port but before this point. Repeat
* EH in such case.
@@ -792,13 +800,6 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
ata_for_each_link(link, ap, HOST_FIRST)
memset(&link->eh_info, 0, sizeof(link->eh_info));

- /* Clear host_eh_scheduled while holding ap->lock such
- * that if exception occurs after this point but
- * before EH completion, SCSI midlayer will
- * re-initiate EH.
- */
- host->host_eh_scheduled = 0;
-
spin_unlock_irqrestore(ap->lock, flags);
ata_eh_release(ap);
} else {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/