mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/4] [Target_Core_Mod/PERSISTENT_RESERVATIONS]: Fix RELATIVE TARGET PORT IDENTIFIER usage
@ 2009-02-02  6:01 Nicholas A. Bellinger
  0 siblings, 0 replies; only message in thread
From: Nicholas A. Bellinger @ 2009-02-02  6:01 UTC (permalink / raw)
  To: LKML, linux-scsi
  Cc: Douglas Gilbert, James Bottomley, Martin K. Petersen, Ming Zhang,
	Arne Redlich, Ross S. W. Walker, Rafiu Fakunle, Hannes Reinecke,
	Mike Christie, FUJITA Tomonori

>From 1a0caf6fad1dc0067b62639b113b59f0046c6781 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@linux-iscsi.org>
Date: Sun, 1 Feb 2009 21:34:07 -0800
Subject: [PATCH 2/4] [Target_Core_Mod/PERSISTENT_RESERVATIONS]: Fix RELATIVE TARGET PORT IDENTIFIER usage

This patch adds the proper usage of RELATIVE TARGET PORT IDENTIFIER to
PRIN READ_FULL_STATUS and ConfigFS under $HBA/$DEV/pr/res_pr_holder_tg_port.

Here is what PRIN READ_FULL_STATUS looks like from the Linux/iSCSI Initiator side:

initiator:# sg_persist --in --read-full-status -v /dev/sde
    inquiry cdb: 12 00 00 00 24 00
  LIO-ORG  IBLOCK  v3.0
  Peripheral device type: disk
    Persistent Reservation In cmd: 5e 03 00 00 00 00 00 20 00 00
  PR generation=0x5
    Key=0x5678efff
      All target ports bit clear
      Relative port address: 0x1
      << Reservation holder >>
      scope: LU_SCOPE,  type: Write Exclusive
      Transport Id of initiator:
        iSCSI world wide unique port id: iqn.1993-08.org.debian:01:2dadf92d0ef

And from the Target_Core_Mod/ConfigFS with LIO-Target v3.0 side:

target:# cat /sys/kernel/config/target/core/iblock_0/lvm_test0/pr/*
SPC-3 Reservation: iSCSI Initiator: iqn.1993-08.org.debian:01:2dadf92d0ef
SPC-3 Reservation: Single Target Port registration
0x00000005
SPC-3 Reservation: iSCSI Target Node Endpoint: iqn.2003-01.org.linux-iscsi.target.i686:sn.cff3eedbd2fd
SPC-3 Reservation: Relative Port Identifer Tag: 1 iSCSI Portal Group Tag: 1 iSCSI Logical Unit: 0
SPC-3 PR Registrations:
iSCSI Node: iqn.1993-08.org.debian:01:2dadf92d0ef Key: 0x000000005678efff PRgen: 0x00000004
SPC-3 Reservation Type: Write Exclusive Access
SPC3_PERSISTENT_RESERVATIONS

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 drivers/lio-core/target_core_configfs.c |    8 +++++---
 drivers/lio-core/target_core_pr.c       |    8 ++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/lio-core/target_core_configfs.c b/drivers/lio-core/target_core_configfs.c
index 0aa633a..08229dd 100644
--- a/drivers/lio-core/target_core_configfs.c
+++ b/drivers/lio-core/target_core_configfs.c
@@ -950,9 +950,11 @@ static ssize_t target_core_dev_pr_show_attr_res_pr_holder_tg_port (
 	len += sprintf(page+len, "SPC-3 Reservation: %s"
 		" Target Node Endpoint: %s\n", tfo->get_fabric_name(),
 		tfo->tpg_get_wwn(se_tpg));      
-	len += sprintf(page+len, "SPC-3 Reservation: Portal"
-		" Identifer Tag: %hu Logical Unit: %u\n",
-		tfo->tpg_get_tag(se_tpg), lun->unpacked_lun);
+	len += sprintf(page+len, "SPC-3 Reservation: Relative Port"
+		" Identifer Tag: %hu %s Portal Group Tag: %hu"
+		" %s Logical Unit: %u\n", lun->lun_sep->sep_rtpi,
+		tfo->get_fabric_name(), tfo->tpg_get_tag(se_tpg),
+		tfo->get_fabric_name(), lun->unpacked_lun);
 	spin_unlock(&dev->dev_reservation_lock);
 
 	return(len);
diff --git a/drivers/lio-core/target_core_pr.c b/drivers/lio-core/target_core_pr.c
index 3b50ff2..0092a8b 100644
--- a/drivers/lio-core/target_core_pr.c
+++ b/drivers/lio-core/target_core_pr.c
@@ -593,7 +593,7 @@ static int core_scsi3_pro_reserve (
 	if (!(pr_reg->pr_reg_all_tg_pt) &&
 	     (pr_reg->pr_reg_tg_pt_lun != se_lun)) {
 		printk(KERN_ERR "SPC-3 PR: Unable to handle RESERVE because"
-			" ALL_TG_PT=0 and RESERVE was not received on same "
+			" ALL_TG_PT=0 and RESERVE was not received on same"
 			" target port as REGISTER\n");
 		return(PYX_TRANSPORT_RESERVATION_CONFLICT);
 	}
@@ -1249,10 +1249,10 @@ static int core_scsi3_pri_read_full_status (se_cmd_t *cmd)
 		 * IDENTIFIER field are not defined by this standard.
 		 */
 		if (!(pr_reg->pr_reg_all_tg_pt)) {
-			u16 tpgt = TPG_TFO(se_tpg)->tpg_get_tag(se_tpg);
+			se_port_t *port = pr_reg->pr_reg_tg_pt_lun->lun_sep;
 
-			buf[off++] = ((tpgt >> 8) & 0xff);
-			buf[off++] = (tpgt & 0xff);
+			buf[off++] = ((port->sep_rtpi >> 8) & 0xff);
+			buf[off++] = (port->sep_rtpi & 0xff);
 		} else
 			off += 2; /* Skip over RELATIVE TARGET PORT IDENTIFER */
 
-- 
1.5.4.1




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-02  6:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-02  6:01 [PATCH 2/4] [Target_Core_Mod/PERSISTENT_RESERVATIONS]: Fix RELATIVE TARGET PORT IDENTIFIER usage Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®