summaryrefslogtreecommitdiff
path: root/drivers/target/target_core_tpg.c
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-05-21 07:21:08 +0300
committerNicholas Bellinger <nab@linux-iscsi.org>2015-06-01 10:27:56 +0300
commit9e37d042cfcb003b885bb4c531cd6f07f62647d1 (patch)
tree8f198eb93f269c0ebe7a69b018293e2814316aee /drivers/target/target_core_tpg.c
parent4cc987eaff9144182cde88d6d132420c28d3f81b (diff)
downloadlinux-9e37d042cfcb003b885bb4c531cd6f07f62647d1.tar.xz
target: Drop se_lun->lun_active for existing percpu lun_ref
With se_port_t and t10_alua_tg_pt_gp_member being absored into se_lun, there is no need for an extra atomic_t based reference count for PR ALL_TG_PT=1 and ALUA access state transition. Go ahead and use the existing percpu se_lun->lun_ref instead, and convert the two special cases to percpu_ref_tryget_live() to avoid se_lun if transport_clear_lun_ref() has already been invoked to shutdown the se_lun. Cc: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_tpg.c')
-rw-r--r--drivers/target/target_core_tpg.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index 5b30940ccaf2..b9fcf2c4898e 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -607,7 +607,6 @@ struct se_lun *core_tpg_alloc_lun(
mutex_init(&lun->lun_tg_pt_md_mutex);
INIT_LIST_HEAD(&lun->lun_tg_pt_gp_link);
spin_lock_init(&lun->lun_tg_pt_gp_lock);
- atomic_set(&lun->lun_active, 0);
lun->lun_tpg = tpg;
return lun;
@@ -667,13 +666,16 @@ void core_tpg_remove_lun(
struct se_device *dev = rcu_dereference_raw(lun->lun_se_dev);
core_clear_lun_from_tpg(lun, tpg);
+ /*
+ * Wait for any active I/O references to percpu se_lun->lun_ref to
+ * be released. Also, se_lun->lun_ref is now used by PR and ALUA
+ * logic when referencing a remote target port during ALL_TGT_PT=1
+ * and generating UNIT_ATTENTIONs for ALUA access state transition.
+ */
transport_clear_lun_ref(lun);
mutex_lock(&tpg->tpg_lun_mutex);
if (lun->lun_se_dev) {
- while (atomic_read(&lun->lun_active))
- cpu_relax();
-
target_detach_tg_pt_gp(lun);
spin_lock(&dev->se_port_lock);