aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
authornagalakshmi.nandigama@lsi.com <nagalakshmi.nandigama@lsi.com>2011-11-30 21:13:50 -0500
committerJames Bottomley <JBottomley@Parallels.com>2011-12-15 01:57:32 -0500
commit23edb6e71696a5da9c5f3987d22221e12370dbce (patch)
tree3197b8876e9d747307dd0ef60a468eca70d7a41d /drivers/scsi/mpt2sas
parentc1bc0704e52f200bc747c6bddb970a3686e230ab (diff)
[SCSI] mpt2sas: Do not set sas_device->starget to NULL from the slave_destroy callback when all the LUNS have been deleted
If the sas_device->starget to NULL from slave_destroy callback for LUN=1 even though LUN=0 exist, results in entire target getting deleted. To resolve the issue, the driver should only set sas_device->starget to NULL when all the LUNS have been deleted from the slave_destroy. Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 5060634f7651..a9efc4551086 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -612,13 +612,17 @@ _scsih_sas_device_add(struct MPT2SAS_ADAPTER *ioc,
612 if (!mpt2sas_transport_port_add(ioc, sas_device->handle, 612 if (!mpt2sas_transport_port_add(ioc, sas_device->handle,
613 sas_device->sas_address_parent)) { 613 sas_device->sas_address_parent)) {
614 _scsih_sas_device_remove(ioc, sas_device); 614 _scsih_sas_device_remove(ioc, sas_device);
615 } else if (!sas_device->starget) { 615 } else if (!sas_device->starget) {
616 if (!ioc->is_driver_loading) 616 /* When asyn scanning is enabled, its not possible to remove
617 mpt2sas_transport_port_remove(ioc, 617 * devices while scanning is turned on due to an oops in
618 sas_device->sas_address, 618 * scsi_sysfs_add_sdev()->add_device()->sysfs_addrm_start()
619 sas_device->sas_address_parent); 619 */
620 _scsih_sas_device_remove(ioc, sas_device); 620 if (!ioc->is_driver_loading)
621 } 621 mpt2sas_transport_port_remove(ioc,
622 sas_device->sas_address,
623 sas_device->sas_address_parent);
624 _scsih_sas_device_remove(ioc, sas_device);
625 }
622} 626}
623 627
624/** 628/**
@@ -1449,7 +1453,7 @@ _scsih_slave_destroy(struct scsi_device *sdev)
1449 spin_lock_irqsave(&ioc->sas_device_lock, flags); 1453 spin_lock_irqsave(&ioc->sas_device_lock, flags);
1450 sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, 1454 sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc,
1451 sas_target_priv_data->sas_address); 1455 sas_target_priv_data->sas_address);
1452 if (sas_device) 1456 if (sas_device && !sas_target_priv_data->num_luns)
1453 sas_device->starget = NULL; 1457 sas_device->starget = NULL;
1454 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 1458 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
1455 } 1459 }