@@ -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);
@@ -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",
Dynamic acls are not present in remote target, so use NULL for nacl pointer for such registrants. Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com> --- drivers/target/target_cluster_dlm.c | 10 ++++++++++ drivers/target/target_core_pr.c | 17 +++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-)