: Add implict PR RELEASE+UNREGISTER for LUN acl removal
PATCH 1/2 : Add implict PR RELEASE+UNREGISTER for LUN acl removal
Quoted 1 line
From
368bf27a4c577cfdadb743ea987c971c6f70ee5dMon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Thu, 19 Mar 2009 00:37:48 -0700
Subject: [PATCH 1/2] [Target_Core_Mod/Persistent_Reservations]: Add implict PR RELEASE+UNREGISTER for LUN acl removal
This patch adds support for removing existing reservations and/or registrations from a
given se_lun_t mapped se_device_t for a given LUN ACL. This patch fixes the existing
logic where reservations/registrations where being released at se_device_t shutdown time, instead of each time a LUN ACL was explict removed through configfs. The function that handles this logic is called, core_scsi3_free_pr_reg_from_nacl(), and is used in target_core_device.c code.
This patch also adds reference counting to t10_pr_registration_t->pr_res_holders using core_scsi3_locate_pr_reg() and core_scsi3_put_pr_reg(). It also updates core_scsi3_emulate_pro_register(), core_scsi3_pro_reserve(), and core_scsi3_emulate_pro_release() to use core_scsi3_put_pr_reg(). __core_scsi3_free_registration() is the last caller to wait on returning to zero, and then releases t10_pr_registration_t.
Finally, this patch adds __core_scsi3_free_registration() and __core_scsi3_complete_pro_release() functions from existing code that was being duplicated in more than one location. These functions are held by their respective spinlocks when being called, and their orginally callers have been updated to use the new __* prefixed functions.
--- drivers/lio-core/target_core_base.h | 1 + drivers/lio-core/target_core_device.c | 14 ++- drivers/lio-core/target_core_pr.c | 225 ++++++++++++++++++++++++--------- drivers/lio-core/target_core_pr.h | 2 + 4 files changed, 178 insertions(+), 64 deletions(-)
drivers/lio-core/target_core_base.h +1 -0
@@ -286,6 +286,7 @@ typedef struct t10_pr_registration_s {int pr_res_scope;u32 pr_res_generation;u64 pr_res_key; +atomic_t pr_res_holders;struct se_node_acl_s *pr_reg_nacl;struct se_dev_entry_s *pr_reg_deve;struct se_lun_s *pr_reg_tg_pt_lun;
drivers/lio-core/target_core_device.c +10 -4
@@ -482,13 +482,19 @@ void core_update_device_list_for_node( deve->creation_time =get_jiffies_64 (); deve->attach_count++;#endif /* SNMP_SUPPORT */ - }else { - deve->se_lun =NULL ; - deve->lun_flags =0 ; - deve->creation_time =0 ; +spin_unlock_bh (&nacl->device_list_lock); + +return ; } +/* +* Disable se_dev_entry_t LUN ACL mapping +*/ + deve->se_lun =NULL ; + deve->lun_flags =0 ; + deve->creation_time =0 ;spin_unlock_bh (&nacl->device_list_lock); +core_scsi3_free_pr_reg_from_nacl (lun->se_dev, nacl);return ; }
drivers/lio-core/target_core_pr.c +165 -60
463 lines not on this page · raw message
drivers/lio-core/target_core_pr.h +2 -0
@@ -42,6 +42,8 @@extern struct kmem_cache *t10_pr_reg_cache; +extern void core_scsi3_free_pr_reg_from_nacl (struct se_device_s *, +struct se_node_acl_s *);extern void core_scsi3_free_all_registrations (struct se_device_s *);extern unsigned char *core_scsi3_pr_dump_type (int );extern int core_scsi3_emulate_pr (struct se_cmd_s *);
Signature · 1 line
1.5.4.1