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@xxxxxx> Index: scsi-misc-2.6/drivers/scsi/scsi_transport_sas.c =================================================================== --- scsi-misc-2.6.orig/drivers/scsi/scsi_transport_sas.c 2006-01-04 13:35:46.000000000 +0100 +++ scsi-misc-2.6/drivers/scsi/scsi_transport_sas.c 2006-01-04 13:40:22.000000000 +0100 @@ -687,7 +687,17 @@ 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); - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html