diff options
Diffstat (limited to 'drivers/target/target_core_device.c')
| -rw-r--r-- | drivers/target/target_core_device.c | 44 | 
1 files changed, 2 insertions, 42 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index f6e58410ec3f..90f3f4926172 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -223,7 +223,7 @@ struct se_dev_entry *core_get_se_deve_from_rtpi(  				tpg->se_tpg_tfo->fabric_name);  			continue;  		} -		if (lun->lun_rtpi != rtpi) +		if (lun->lun_tpg->tpg_rtpi != rtpi)  			continue;  		kref_get(&deve->pr_kref); @@ -479,47 +479,6 @@ void core_clear_lun_from_tpg(struct se_lun *lun, struct se_portal_group *tpg)  	mutex_unlock(&tpg->acl_node_mutex);  } -int core_alloc_rtpi(struct se_lun *lun, struct se_device *dev) -{ -	struct se_lun *tmp; - -	spin_lock(&dev->se_port_lock); -	if (dev->export_count == 0x0000ffff) { -		pr_warn("Reached dev->dev_port_count ==" -				" 0x0000ffff\n"); -		spin_unlock(&dev->se_port_lock); -		return -ENOSPC; -	} -again: -	/* -	 * Allocate the next RELATIVE TARGET PORT IDENTIFIER for this struct se_device -	 * Here is the table from spc4r17 section 7.7.3.8. -	 * -	 *    Table 473 -- RELATIVE TARGET PORT IDENTIFIER field -	 * -	 * Code      Description -	 * 0h        Reserved -	 * 1h        Relative port 1, historically known as port A -	 * 2h        Relative port 2, historically known as port B -	 * 3h to FFFFh    Relative port 3 through 65 535 -	 */ -	lun->lun_rtpi = dev->dev_rpti_counter++; -	if (!lun->lun_rtpi) -		goto again; - -	list_for_each_entry(tmp, &dev->dev_sep_list, lun_dev_link) { -		/* -		 * Make sure RELATIVE TARGET PORT IDENTIFIER is unique -		 * for 16-bit wrap.. -		 */ -		if (lun->lun_rtpi == tmp->lun_rtpi) -			goto again; -	} -	spin_unlock(&dev->se_port_lock); - -	return 0; -} -  static void se_release_vpd_for_dev(struct se_device *dev)  {  	struct t10_vpd *vpd, *vpd_tmp; @@ -782,6 +741,7 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)  	spin_lock_init(&dev->t10_alua.lba_map_lock);  	INIT_WORK(&dev->delayed_cmd_work, target_do_delayed_work); +	mutex_init(&dev->lun_reset_mutex);  	dev->t10_wwn.t10_dev = dev;  	/*  |