[PATCH 2/2] libata: kill SCSI devices before detaching ata_host

From: Tejun Heo
Date: Thu Mar 06 2008 - 22:12:18 EST


Kill SCSI devices before detaching port. This makes drives properly
shut down on driver unload.

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>
---
drivers/ata/libata-core.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: work1/drivers/ata/libata-core.c
===================================================================
--- work1.orig/drivers/ata/libata-core.c
+++ work1/drivers/ata/libata-core.c
@@ -7236,6 +7236,14 @@ static void ata_port_detach(struct ata_p
if (!ap->ops->error_handler)
goto skip_eh;

+ /* First, tell all SCSI devices that we're going down. Note
+ * that there's a small race window here. Devices which get
+ * hotplugged after forget_host but before EH is killed won't
+ * get shut down by SCSI layer properly and will miss cache
+ * flush and spin down.
+ */
+ scsi_forget_host(ap->scsi_host);
+
/* tell EH we're leaving & flush EH */
spin_lock_irqsave(ap->lock, flags);
ap->pflags |= ATA_PFLAG_UNLOADING;
--
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/