Skip to contentSkip to conversation

: Update APTPL metadata logic for ISIDs in TransportID processing

PATCH New Nicholas A. Bellinger 1 participant 1 message Apr 13, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 : Update APTPL metadata logic for ISIDs in TransportID processing

From: Nicholas Bellinger <[email protected]>

This patch updates Activate Persistence across Target Power-Loss logic in TCM/PR to handle fabrics presenting an ISID in TransportID processing. This includes per TCM backstore metadata written to out struct file in
__core_scsi3_update_aptpl_buf(), and __core_scsi3_check_aptpl_registration()
while doing re-initialization for PR data structures from existing APTPL metadata.

This patch also changes the parser in target_core_dev_pr_store_attr_res_aptpl_metadata() to scan for the new 'initiator_sid=' parameter from incoming configfs attribute data.

---
 drivers/target/target_core_configfs.c |   16 ++++++++++-
 drivers/target/target_core_pr.c       |   50 ++++++++++++++++++++++++++------
 include/target/target_core_pr.h       |    4 +-
 3 files changed, 57 insertions(+), 13 deletions(-)
drivers/target/target_core_configfs.c +15 -1
index acd7fcd..3d0e263 100644
@@ -1212,6 +1212,7 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
 {
 	se_device_t *dev;
 	unsigned char *i_fabric, *t_fabric, *i_port = NULL, *t_port = NULL;
+	unsigned char *isid = NULL;
 	char *ptr, *ptr2, *cur, *buf;
 	unsigned long long tmp_ll;
 	unsigned long tmp_l;
@@ -1270,6 +1271,19 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
 			i_port = ptr;
 			continue;
 		}
+		ptr2 = strstr(cur, "initiator_sid");
+		if (ptr2) {
+			transport_check_dev_params_delim(ptr, &cur);
+			if (strlen(ptr) > PR_REG_ISID_LEN) {
+				printk(KERN_ERR "APTPL metadata initiator_isid"
+					"= exceeds PR_REG_ISID_LEN: %d\n",
+					PR_REG_ISID_LEN);
+				ret = -1;
+				break;
+			}
+			isid = ptr;
+			continue;
+		}
 		ptr2 = strstr(cur, "sa_res_key");
 		if (ptr2) {
 			transport_check_dev_params_delim(ptr, &cur);
@@ -1420,7 +1434,7 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
 	}
 
 	ret = core_scsi3_alloc_aptpl_registration(T10_RES(su_dev), sa_res_key,
-			i_port, mapped_lun, t_port, tpgt, target_lun,
+			i_port, isid, mapped_lun, t_port, tpgt, target_lun,
 			res_holder, all_tg_pt, type);
 out:
 	kfree(buf);
drivers/target/target_core_pr.c +40 -10

121 lines not on this page · raw message

include/target/target_core_pr.h +2 -2
index 4281ede..3708891 100644
@@ -50,8 +50,8 @@ extern int core_pr_dump_initiator_port(struct t10_pr_registration_s *,
 extern int core_scsi2_emulate_crh(struct se_cmd_s *);
 extern int core_scsi3_alloc_aptpl_registration(
 			struct t10_reservation_template_s *, u64,
-			unsigned char *, u32, unsigned char *, u16, u32,
-			int, int, u8);
+			unsigned char *, unsigned char *, u32,
+			unsigned char *, u16, u32, int, int, u8);
 extern int core_scsi3_check_aptpl_registration(struct se_device_s *,
 			struct se_portal_group_s *, struct se_lun_s *,
 			struct se_lun_acl_s *);
Signature · 1 line
1.5.6.5