aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_device.c39
-rw-r--r--drivers/target/target_core_hba.c15
2 files changed, 4 insertions, 50 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 350ed401544e..9e182bd245f0 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -779,49 +779,14 @@ void se_release_vpd_for_dev(struct se_device *dev)
779 return; 779 return;
780} 780}
781 781
782/*
783 * Called with struct se_hba->device_lock held.
784 */
785void se_clear_dev_ports(struct se_device *dev)
786{
787 struct se_hba *hba = dev->se_hba;
788 struct se_lun *lun;
789 struct se_portal_group *tpg;
790 struct se_port *sep, *sep_tmp;
791
792 spin_lock(&dev->se_port_lock);
793 list_for_each_entry_safe(sep, sep_tmp, &dev->dev_sep_list, sep_list) {
794 spin_unlock(&dev->se_port_lock);
795 spin_unlock(&hba->device_lock);
796
797 lun = sep->sep_lun;
798 tpg = sep->sep_tpg;
799 spin_lock(&lun->lun_sep_lock);
800 if (lun->lun_se_dev == NULL) {
801 spin_unlock(&lun->lun_sep_lock);
802 continue;
803 }
804 spin_unlock(&lun->lun_sep_lock);
805
806 core_dev_del_lun(tpg, lun->unpacked_lun);
807
808 spin_lock(&hba->device_lock);
809 spin_lock(&dev->se_port_lock);
810 }
811 spin_unlock(&dev->se_port_lock);
812
813 return;
814}
815
816/* se_free_virtual_device(): 782/* se_free_virtual_device():
817 * 783 *
818 * Used for IBLOCK, RAMDISK, and FILEIO Transport Drivers. 784 * Used for IBLOCK, RAMDISK, and FILEIO Transport Drivers.
819 */ 785 */
820int se_free_virtual_device(struct se_device *dev, struct se_hba *hba) 786int se_free_virtual_device(struct se_device *dev, struct se_hba *hba)
821{ 787{
822 spin_lock(&hba->device_lock); 788 if (!list_empty(&dev->dev_sep_list))
823 se_clear_dev_ports(dev); 789 dump_stack();
824 spin_unlock(&hba->device_lock);
825 790
826 core_alua_free_lu_gp_mem(dev); 791 core_alua_free_lu_gp_mem(dev);
827 se_release_device_for_hba(dev); 792 se_release_device_for_hba(dev);
diff --git a/drivers/target/target_core_hba.c b/drivers/target/target_core_hba.c
index 6ec51cbc018e..0b8f8da89019 100644
--- a/drivers/target/target_core_hba.c
+++ b/drivers/target/target_core_hba.c
@@ -151,19 +151,8 @@ out_free_hba:
151int 151int
152core_delete_hba(struct se_hba *hba) 152core_delete_hba(struct se_hba *hba)
153{ 153{
154 struct se_device *dev, *dev_tmp; 154 if (!list_empty(&hba->hba_dev_list))
155 155 dump_stack();
156 spin_lock(&hba->device_lock);
157 list_for_each_entry_safe(dev, dev_tmp, &hba->hba_dev_list, dev_list) {
158
159 se_clear_dev_ports(dev);
160 spin_unlock(&hba->device_lock);
161
162 se_release_device_for_hba(dev);
163
164 spin_lock(&hba->device_lock);
165 }
166 spin_unlock(&hba->device_lock);
167 156
168 hba->transport->detach_hba(hba); 157 hba->transport->detach_hba(hba);
169 158