[RFC PATCH 40/48] target: cluster: sync PR for dynamic acls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dynamic acls are not present in remote target, so use NULL for nacl
pointer for such registrants.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@xxxxxxxxx>
---
 drivers/target/target_cluster_dlm.c | 10 ++++++++++
 drivers/target/target_core_pr.c     | 17 +++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/target/target_cluster_dlm.c b/drivers/target/target_cluster_dlm.c
index 6b7cb3175e3a..6dbe1a0b21e2 100644
--- a/drivers/target/target_cluster_dlm.c
+++ b/drivers/target/target_cluster_dlm.c
@@ -466,6 +466,16 @@ target_create_pr_reg(struct se_device *dev,
 			spin_unlock(&lun->lun_deve_lock);
 			goto out;
 		}
+		/* deve not found - that is a dynamic acl */
+		pr_reg = __core_scsi3_do_alloc_registration(
+				dev, NULL, initiatorname, lun->unpacked_lun,
+				pr_reg_data->rtpi,
+				NULL, lun->unpacked_lun,
+				isid,
+				pr_reg_data->key,
+				pr_reg_data->is_all_tg_pt,
+				pr_data->pr_aptpl);
+
 		percpu_ref_put(&lun->lun_ref);
 		spin_unlock(&lun->lun_deve_lock);
 		spin_lock(&dev->se_port_lock);
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index fe2f64826e9e..22f2aa91cf2e 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -644,10 +644,13 @@ struct t10_pr_registration *__core_scsi3_do_alloc_registration(
 	 *
 	 * Otherwise, locate se_dev_entry now and obtain a reference until
 	 * registration completes in __core_scsi3_add_registration().
+	 *
+	 * NULL nacl means that this registration is for dynamic acl on a remote
+	 * target - no need to find a deve.
 	 */
 	if (dest_deve) {
 		pr_reg->pr_reg_deve = dest_deve;
-	} else {
+	} else if (nacl) {
 		rcu_read_lock();
 		pr_reg->pr_reg_deve = target_nacl_find_deve(nacl, mapped_lun);
 		if (!pr_reg->pr_reg_deve) {
@@ -1270,11 +1273,13 @@ void __core_scsi3_free_registration(
 		cpu_relax();
 	}
 
-	rcu_read_lock();
-	deve = target_nacl_find_deve(nacl, pr_reg->pr_res_mapped_lun);
-	if (deve)
-		clear_bit(DEF_PR_REG_ACTIVE, &deve->deve_flags);
-	rcu_read_unlock();
+	if (nacl) {
+		rcu_read_lock();
+		deve = target_nacl_find_deve(nacl, pr_reg->pr_res_mapped_lun);
+		if (deve)
+			clear_bit(DEF_PR_REG_ACTIVE, &deve->deve_flags);
+		rcu_read_unlock();
+	}
 
 	spin_lock(&pr_tmpl->registration_lock);
 	pr_debug("SPC-3 PR Service Action: UNREGISTER Initiator Node: %s%s\n",
-- 
2.25.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux