Skip to contentSkip to conversation

: Add support for PROUT PREEMPT service action

PATCH New Nicholas A. Bellinger 1 participant 1 message Mar 25, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Add support for PROUT PREEMPT service action

Greetings all,

This patch adds complete SPC-3 compliant PROUT PREEMPT service action support, including support for all PROUT TYPEs and all UNIT ATTENTION conditions for I_T nexuses that have had their reservations/registrations preempted as defined by spc4r17.

This is the primary PR service action that is used to fence a failing node when using SPC-3 compliant persistent reservations with cluster storage. Currently, Linux distributions using fence_scsi use PROUT service action PREEMPT_AND_ABORT for cluster operation. This logic will be added to core_scsi3_emulate_pro_preempt() as testing continues against different client side SPC-3 compliant PR setups.

These patches are made against lio-core-2.6.git/master and tested on v2.6.29 x86 32-bit HVM using sg_persist and sg_request from sg3_utils. The lio-core-2.6.git tree can be found at:

http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=summary

Here is what it looks like in action, here are two iSCSI LUNs connected via two iSCSI sessions on two different iSCSI target ports

*) Create registrations for both target ports..

initiator# sg_persist --out --register --param-sark=0x1234abcd -Y -v /dev/sde

    inquiry cdb: 12 00 00 00 24 00
  LIO-ORG  IBLOCK  3.0
  Peripheral device type: disk
    Persistent Reservation Out cmd: 5f 00 00 00 00 00 00 00 18 00
initiator# sg_persist --out --register --param-sark=0x4567ffff -Y -v /dev/sdh
    inquiry cdb: 12 00 00 00 24 00
  LIO-ORG  IBLOCK  3.0
  Peripheral device type: disk
    Persistent Reservation Out cmd: 5f 00 00 00 00 00 00 00 18 00

PR out: command (Register) successful

target# tail -f /var/log/message

SPC-3 PR [iSCSI] Service Action: REGISTER Initiator Node: iqn.1993-08.org.debian:01:2dadf92d0ef SPC-3 PR [iSCSI] for ALL TCM Subsystem iblock Object Target Port(s)
SPC-3 PR [iSCSI] SA Res Key: 0x000000001234abcd PRgeneration: 0x00000000
SPC-3 PR [iSCSI] Service Action: REGISTER Initiator Node: iqn.1993-08.org.debian:01:2dadf92d0ef SPC-3 PR [iSCSI] for ALL TCM Subsystem iblock Object Target Port(s)
SPC-3 PR [iSCSI] SA Res Key: 0x000000004567ffff PRgeneration: 0x00000001

*) Create a write exclusive, all registrants persistent reservation on the first target port

initiator# sg_persist --out --reserve --param-rk=0x1234abcd --prout-type=7 -v /dev/sde

    inquiry cdb: 12 00 00 00 24 00
  LIO-ORG  IBLOCK  3.0
  Peripheral device type: disk
    Persistent Reservation Out cmd: 5f 01 07 00 00 00 00 00 18 00

PR out: command (Reserve) successful

target# tail -f /var/log/messages

SPC-3 PR [iSCSI] Service Action: RESERVE created new reservation holder TYPE: Write Exclusive Access, All Registrants ALL_TG_PT: 1 SPC-3 PR [iSCSI] RESERVE Node: iqn.1993-08.org.debian:01:2dadf92d0ef

*) Preempt the existing reservation with a write exclusive, registrants only persistent reservation
on the second target port

initiator# sg_persist --out --preempt --param-rk=0x4567ffff --param-sark=0x1234abcd --prout-type=5 -v /dev/sdh

    inquiry cdb: 12 00 00 00 24 00
  LIO-ORG  IBLOCK  3.0
  Peripheral device type: disk
    Persistent Reservation Out cmd: 5f 04 05 00 00 00 00 00 18 00

PR out: command (Preempt) successful

target# tail -f /var/log/messages

SPC-3 PR [iSCSI] Service Action: implict RELEASE cleared reservation holder TYPE: Write Exclusive Access, All Registrants ALL_TG_PT: 1 SPC-3 PR [iSCSI] RELEASE Node: iqn.1993-08.org.debian:01:2dadf92d0ef
SPC-3 PR [iSCSI] Service Action: UNREGISTER Initiator Node: iqn.1993-08.org.debian:01:2dadf92d0ef
SPC-3 PR [iSCSI] for ALL TCM Subsystem iblock Object Target Port(s)
SPC-3 PR [iSCSI] SA Res Key: 0x000000001234abcd PRgeneration: 0x00000000
[iSCSI]: Allocated UNIT ATTENTION, mapped LUN: 0, ASC: 0x2a, ASCQ: 0x03
SPC-3 PR [iSCSI] Service Action: PREEMPT created new reservation holder TYPE: Write Exclusive Access, Registrants Only ALL_TG_PT: 1 SPC-3 PR [iSCSI] PREEMPT from Node: iqn.1993-08.org.debian:01:2dadf92d0ef

*) Call REQUEST_SENSE on the preempted target port to verify the ASC/ASCQ

initiator# sg_requests -v /dev/sde

    Request Sense cmd: 03 00 00 00 fc 00

Decode parameter data as sense data:
Fixed format, current; Sense key: Unit Attention Additional sense: Reservations preempted

target# tail -f /var/log/messages

[iSCSI]: Released UNIT ATTENTION condition, mapped LUN: 0, reported ASC: 0x2a, ASCQ: 0x03

---
 drivers/lio-core/target_core_base.h |    1 +
 drivers/lio-core/target_core_pr.c   |  314 ++++++++++++++++++++++++++++++++++-
 2 files changed, 309 insertions(+), 6 deletions(-)
drivers/lio-core/target_core_base.h +1 -0
index cb56d6a..5849a1f 100644
@@ -286,6 +286,7 @@ typedef struct t10_pr_registration_s {
 	int pr_res_holder;
 	int pr_res_type;
 	int pr_res_scope;
+	u32 pr_res_mapped_lun;
 	u32 pr_res_generation;
 	u64 pr_res_key;
 	atomic_t pr_res_holders;
drivers/lio-core/target_core_pr.c +308 -6

369 lines not on this page · raw message

Signature · 1 line
1.5.4.1