: Add Service Action REGISTER logic
PATCH 6/7 : Add Service Action REGISTER logic
Quoted 1 line
From
efe89a76da4a6c065ab972884afecd786d6881f6Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Mon, 26 Jan 2009 00:41:53 -0800
Subject: [PATCH 6/7] [Target_Core_Mod/PERSISTENT_RESERVATION]: Add Service Action REGISTER logic
This patch adds a number of functions including proper support using sg3_utils sg_persist --register. It also adds support for changing a registered registration key and PERSISTENT_RESERVE_OUT Service Actions READ_KEYS and READ_RESERVATION.
This code follows spc4r14, and looks like the follwing from Target_Core_Mod/ConfigFS for a *SINGLE* $HBA/$STORAGE_OBJECT:
/sys/kernel/config/target/core/
|-- iblock_0 | |-- hba_info | `-- lvm_test0 | |-- attrib | | |-- hw_max_sectors | | |-- hw_queue_depth | | |-- max_sectors | | |-- queue_depth | | |-- status_thread | | |-- status_thread_tur | | `-- task_timeout | |-- control | |-- enable | |-- fd | |-- info | |-- pr | | |-- res_holder | | |-- res_pr_all_tgt_pts | | |-- res_pr_generation | | |-- res_pr_registered_i_pts | | `-- res_type | `-- wwn | |-- evpd_assoc_logical_unit | |-- evpd_assoc_scsi_target_device | |-- evpd_assoc_target_port | |-- evpd_protocol_identifier | `-- evpd_unit_serial
Here is what it looks like from Target_Core_Mod/ConfigFS from a active PR REGISTER invocation:
*) target_core_mod/IBLOCK: configfs
target:/mnt/sdb/lio-core-2.6# cat /sys/kernel/config/target/core/iblock_0/lvm_test0/pr/* Not Implemented yet Not Implemented Yet 0x00000004 iSCSI Node: iqn.1993-08.org.debian:01:2dadf92d0ef Key: 0x000000005678efff PRgen: 0x00000003 SPC3_PERSISTENT_RESERVATIONS
*) target_core_mod/IBLOCK: dmesg
SPC-3 PR [iSCSI] Service Action: REGISTER Initiator Node: iqn.1993-08.org.debian:01:2dadf92d0ef
SPC-3 PR [iSCSI] for SINGLE TCM Subsystem iblock Object Port(s)
SPC-3 PR [iSCSI] SA Res Key: 0x000000001234abcd PRgeneration: 0x00000000
SPC-3 PR [iSCSI] REGISTER: Changed Reservation Key for iqn.1993-08.org.debian:01:2dadf92d0ef to: 0x000000005678efff PRgeneration: 0x00000001
Here is what legacy SPC-2 Reservations looks like from ConfigFS
target:/mnt/sdb/lio-core-2.6# cat /sys/kernel/config/target/core/rd_mcp_0/ramdisk/pr/* None res_pr_generation only valid for SPC3_PERSISTENT_RESERVATIONS res_pr_generation only valid for SPC3_PERSISTENT_RESERVATIONS res_pr_registered_i_pts only valid for SPC3_PERSISTENT_RESERVATIONS SPC2_RESERVATIONS
This code is a WIP for >= SPC-3 Persistent Rervations across Target_Core_Mod/ConfigFS
--- drivers/lio-core/target_core_device.c | 5 +- drivers/lio-core/target_core_pr.c | 495 ++++++++++++++++++++++++++++++++- drivers/lio-core/target_core_pr.h | 18 ++ 3 files changed, 501 insertions(+), 17 deletions(-)
drivers/lio-core/target_core_device.c +2 -3
@@ -50,6 +50,7 @@#include <iscsi_target_error.h> #include <target_core_device.h> #include <target_core_hba.h> +#include <target_core_pr.h> #include <target_core_tpg.h> #include <target_core_transport.h> #include <target_core_fabric_ops.h>
@@ -565,9 +566,6 @@ done: buf[2 ] = ((lun_count >>8 ) &0xff ); buf[3 ] = (lun_count &0xff ); - se_task->task_scsi_status =GOOD ; -transport_complete_task (se_task,1 ); -return (PYX_TRANSPORT_SENT_TO_TRANSPORT ); }
@@ -593,6 +591,7 @@ extern void se_release_device_for_hba (se_device_t *dev) hba->dev_count--;spin_unlock (&hba->device_lock); +core_scsi3_free_all_registrations (dev);se_release_evpd_for_dev (dev);kfree (dev->dev_status_queue_obj);
drivers/lio-core/target_core_pr.c +481 -14
581 lines not on this page · raw message
drivers/lio-core/target_core_pr.h +18 -0
@@ -20,6 +20,24 @@#define PRI_READ_RESERVATION 0x01#define PRI_REPORT_CAPABILITIES 0x02#define PRI_READ_FULL_STATUS 0x03 +/* +* PERSISTENT_RESERVE_ SCOPE field +* +* spc4r17 section 6.13.3.3 Table 163 +*/ +#define PR_SCOPE_LU_SCOPE 0x00 +/* +* PERSISTENT_RESERVE_* TYPE field +* +* spc4r17 section 6.13.3.4 Table 164 +*/ +#define PR_TYPE_WRITE_EXCLUSIVE 0x01 +#define PR_TYPE_EXCLUSIVE_ACCESS 0x03 +#define PR_TYPE_WRITE_EXCLUSIVE_REGONLY 0x05 +#define PR_TYPE_EXCLUSIVE_ACCESS_REGONLY 0x06 +#define PR_TYPE_WRITE_EXCLUSIVE_ALLREG 0x07 +#define PR_TYPE_EXCLUSIVE_ACCESS_ALLREG 0x08 +extern void core_scsi3_free_all_registrations (struct se_device_s *);extern int core_scsi3_emulate_pr (struct se_cmd_s *);extern int core_setup_reservations (struct se_device_s *);
Signature · 1 line
1.5.4.1