summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagalakshmi.nandigama@lsi.com <nagalakshmi.nandigama@lsi.com>2011-10-21 10:06:33 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-11 09:44:24 -0800
commit218782d30177214893625e8d6523191caa5e023b (patch)
treedf4a4d85deccd49fa70ab1f751b0d0cee5ef9432
parentc0224b906310fc773affedc88056e8d873617248 (diff)
mpt2sas: Fix for system hang when discovery in progress
commit 0167ac67ff6f35bf2364f7672c8012b0cd40277f upstream. Fix for issue : While discovery is in progress, hot unplug and hot plug of enclosure connected to the controller card is causing system to hang. When a device is in the process of being detected at driver load time then if it is removed, the device that is no longer present will not be added to the list. So the code in _scsih_probe_sas() is rearranged as such so the devices that failed to be detected are not added to the list. Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 6abd2fcc43e2..97aac82eef3c 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -7461,22 +7461,27 @@ _scsih_probe_sas(struct MPT2SAS_ADAPTER *ioc)
/* SAS Device List */
list_for_each_entry_safe(sas_device, next, &ioc->sas_device_init_list,
list) {
- spin_lock_irqsave(&ioc->sas_device_lock, flags);
- list_move_tail(&sas_device->list, &ioc->sas_device_list);
- spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
if (ioc->hide_drives)
continue;
if (!mpt2sas_transport_port_add(ioc, sas_device->handle,
sas_device->sas_address_parent)) {
- _scsih_sas_device_remove(ioc, sas_device);
+ list_del(&sas_device->list);
+ kfree(sas_device);
+ continue;
} else if (!sas_device->starget) {
mpt2sas_transport_port_remove(ioc,
sas_device->sas_address,
sas_device->sas_address_parent);
- _scsih_sas_device_remove(ioc, sas_device);
+ list_del(&sas_device->list);
+ kfree(sas_device);
+ continue;
+
}
+ spin_lock_irqsave(&ioc->sas_device_lock, flags);
+ list_move_tail(&sas_device->list, &ioc->sas_device_list);
+ spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
}
}