]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] sas: fix removal of devices behind expanders
authorChristoph Hellwig <hch@lst.de>
Wed, 4 Jan 2006 12:45:20 +0000 (13:45 +0100)
committerJames Bottomley <jejb@mulgrave.(none)>
Sat, 14 Jan 2006 16:54:44 +0000 (10:54 -0600)
We need to iterate over all children when removing and expander, else
stale objects will be around after host removal.  This fixes the oops
Eric Moore saw when removing and reloading mptsas.

Also don't try the scsi_remove_target call unless operating on an end
device.  The current unconditional call is harmless but confusing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_transport_sas.c

index 357b52f5f9969a8f71fa39c3cc38ddd853b2c0fa..e950435a11d8d6bc264e04e16b354dae07d7a6ad 100644 (file)
@@ -687,7 +687,17 @@ sas_rphy_delete(struct sas_rphy *rphy)
        struct Scsi_Host *shost = dev_to_shost(parent->dev.parent);
        struct sas_host_attrs *sas_host = to_sas_host_attrs(shost);
 
-       scsi_remove_target(dev);
+       switch (rphy->identify.device_type) {
+       case SAS_END_DEVICE:
+               scsi_remove_target(dev);
+               break;
+       case SAS_EDGE_EXPANDER_DEVICE:
+       case SAS_FANOUT_EXPANDER_DEVICE:
+               device_for_each_child(dev, NULL, do_sas_phy_delete);
+               break;
+       default:
+               break;
+       }
 
        transport_remove_device(dev);
        device_del(dev);