: Fix RELATIVE TARGET PORT IDENTIFIER usage
PATCH 2/4 : Fix RELATIVE TARGET PORT IDENTIFIER usage
Quoted 1 line
From
1a0caf6fad1dc0067b62639b113b59f0046c6781Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
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 registration0x00000005
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 AccessSPC3_PERSISTENT_RESERVATIONS
--- drivers/lio-core/target_core_configfs.c | 8 +++++--- drivers/lio-core/target_core_pr.c | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/lio-core/target_core_configfs.c +5 -3
@@ -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);
drivers/lio-core/target_core_pr.c +4 -4
@@ -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 */
Signature · 1 line
1.5.4.1