target: Allow demo-mode sessions with INQUIRY 'not connected' status
Subsystems (2)
cover target: Allow demo-mode sessions with INQUIRY 'not connected' status
From: Nicholas Bellinger <[email protected]>
Hi Roland and Andrew,
Here is the series for target_core v4.1 (lio-core-2.6.git/master) to allow demo-mode I_T FC nexuses (struct se_session) to login without the active fabric Port/LUNs appearing as the default layout with generate_node_acl=1 WWPN endpoint access.
This also changes standard INQUIRY response to set 0x3f (not connected) status as recommended by Roland for those fabrics like tcm_qla2xxx that expect to have initiators be at least able login and recognize 'not connected' status with the default virtual LUN=0 device. This is expected by modern qla2xxx initiators, and will currently cause ABORT -> DEVICE_RESET when we explictly disable demo-mode access for the WWPN and only allow explict NodeACLs+MappedLUNs to establish a FC Nexus.
The main question here is if running 'not connected' as the default for virtual LUN=0 access is OK for all cases here. Any comments folks..?
With the series, the following lio-core-2.6.git/master commit is also being reverted
commit a138af3ef3b199226ad2cc3ffb24c494302d0f4c
Author: Nicholas Bellinger <[email protected]>
Date: Mon Jul 25 22:11:43 2011 +0000
tcm_qla2xxx: Remove Demo-mode by default settings
Thanks,
Nicholas Bellinger (3):
target: Change TCM_NON_EXISTENT_LUN response to ASC=LOGICAL UNIT NOT
SUPPORTED
target: Make standard INQUIRY return 'not connected' for
tpg_virt_lun0
tcm_qla2xxx: Add tfo->tpg_check_demo_mode_login_only usage
drivers/target/target_core_cdb.c | 11 ++++++++--- drivers/target/target_core_tpg.c | 12 ++++++++++-- drivers/target/target_core_transport.c | 7 +++++++ drivers/target/tcm_qla2xxx/tcm_qla2xxx_configfs.c | 2 ++ include/target/target_core_fabric_ops.h | 6 ++++++ 5 files changed, 33 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.2.5
PATCH 1/3 target: Change TCM_NON_EXISTENT_LUN response to ASC=LOGICAL UNIT NOT SUPPORTED
From: Nicholas Bellinger <[email protected]>
This patch changes transport_send_check_condition_and_sense() for TCM_NON_EXISTENT_LUN emulation to use 0x25 (LOGICAL UNIT NOT SUPPORTED) instead of the original 0x20 (INVALID COMMAND OPERATION CODE). This is helpful to distinguish between TCM_UNSUPPORTED_SCSI_OPCODE ASC=0x20 exceptions.
--- drivers/target/target_core_transport.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/target/target_core_transport.c +7 -0
@@ -4701,6 +4701,13 @@ int transport_send_check_condition_and_sense(*/ switch (reason) {case TCM_NON_EXISTENT_LUN : +/* CURRENT ERROR */ + buffer[offset] =0x70 ; +/* ILLEGAL REQUEST */ + buffer[offset+SPC_SENSE_KEY_OFFSET ] =ILLEGAL_REQUEST ; +/* LOGICAL UNIT NOT SUPPORTED */ + buffer[offset+SPC_ASC_KEY_OFFSET ] =0x25 ; +break ;case TCM_UNSUPPORTED_SCSI_OPCODE :case TCM_SECTOR_COUNT_TOO_MANY :/* CURRENT ERROR */
Signature · 1 line
1.7.2.5
PATCH 2/3 target: Make standard INQUIRY return 'not connected' for tpg_virt_lun0
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch changes target_emulate_inquiry_std() to set the 'not connected' (0x35) bit in standard INQUIRY response data when we are processing a request to a virtual LUN=0 mapping from struct se_device *g_lun0_dev that have been setup for us in transport_lookup_cmd_lun().
This addresses an issue where qla2xxx FC clients need to be able to create demo-mode I_T FC Nexuses by default, but should not be exposing the default set of TPG LUNs to all FC clients. This includes adding an new optional target_core_fabric_ops->tpg_check_demo_mode_login_only() caller to allow demo_mode nexuses to skip the old default of bulding a demo-mode MappedLUNs list via core_tpg_add_node_to_devs().
--- drivers/target/target_core_cdb.c | 11 ++++++++--- drivers/target/target_core_tpg.c | 12 ++++++++++-- include/target/target_core_fabric_ops.h | 6 ++++++ 3 files changed, 24 insertions(+), 5 deletions(-)
drivers/target/target_core_cdb.c +8 -3
@@ -67,6 +67,7 @@ target_emulate_inquiry_std(struct se_cmd *cmd) {struct se_lun *lun = cmd->se_lun;struct se_device *dev = cmd->se_dev; +struct se_portal_group *tpg = lun->lun_sep->sep_tpg;unsigned char *buf;/*
@@ -81,9 +82,13 @@ target_emulate_inquiry_std(struct se_cmd *cmd) buf =transport_kmap_first_data_page (cmd); - buf[0 ] = dev->transport->get_device_type (dev); -if (buf[0 ] ==TYPE_TAPE ) - buf[1 ] =0x80 ; +if (dev == tpg->tpg_virt_lun0.lun_se_dev) { + buf[0 ] =0x3f ;/* Not connected */ + }else { + buf[0 ] = dev->transport->get_device_type (dev); +if (buf[0 ] ==TYPE_TAPE ) + buf[1 ] =0x80 ; + } buf[2 ] = dev->transport->get_device_rev (dev);/*
drivers/target/target_core_tpg.c +10 -2
@@ -296,8 +296,16 @@ struct se_node_acl *core_tpg_check_initiator_node_acl( tpg->se_tpg_tfo->tpg_release_fabric_acl (tpg, acl);return NULL ; } - -core_tpg_add_node_to_devs (acl, tpg); +/* +* Here we only create demo-mode MappedLUNs from the active +* TPG LUNs if the fabric is not explictly asking for +* tpg_check_demo_mode_login_only() == 1. +*/ +if ((tpg->se_tpg_tfo->tpg_check_demo_mode_login_only !=NULL ) && + (tpg->se_tpg_tfo->tpg_check_demo_mode_login_only (tpg) ==1 )) +do { ; }while (0 ); +else +core_tpg_add_node_to_devs (acl, tpg);spin_lock_bh (&tpg->acl_node_lock);list_add_tail (&acl->acl_list, &tpg->acl_node_list);
include/target/target_core_fabric_ops.h +6 -0
@@ -27,6 +27,12 @@ struct target_core_fabric_ops {int (*tpg_check_demo_mode_cache)(struct se_portal_group *);int (*tpg_check_demo_mode_write_protect)(struct se_portal_group *);int (*tpg_check_prod_mode_write_protect)(struct se_portal_group *); +/* +* Optionally used by fabrics to allow demo-mode login, but not +* expose any TPG LUNs, and return 'not connected' in standard +* inquiry response +*/ +int (*tpg_check_demo_mode_login_only)(struct se_portal_group *);struct se_node_acl *(*tpg_alloc_fabric_acl)(struct se_portal_group *); void (*tpg_release_fabric_acl)(struct se_portal_group *,
Signature · 1 line
1.7.2.5
PATCH 3/3 tcm_qla2xxx: Add tfo->tpg_check_demo_mode_login_only usage
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch enables target_core_fabric_ops->tpg_check_demo_mode_login_only=1 in tcm_qla2xxx in order to allow demo-mode I_T FC nexuses to login, and only return 'not connected' in standard INQUIRY response instead of the default TPG LUN layout.
--- drivers/target/tcm_qla2xxx/tcm_qla2xxx_configfs.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/target/tcm_qla2xxx/tcm_qla2xxx_configfs.c +2 -0
@@ -1201,6 +1201,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = { .tpg_check_demo_mode_cache = tcm_qla2xxx_check_demo_mode_cache, .tpg_check_demo_mode_write_protect = tcm_qla2xxx_check_demo_write_protect, .tpg_check_prod_mode_write_protect = tcm_qla2xxx_check_prod_write_protect, + .tpg_check_demo_mode_login_only = tcm_qla2xxx_check_true, .tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl, .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl, .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index,
@@ -1253,6 +1254,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { .tpg_check_demo_mode_cache = tcm_qla2xxx_check_true, .tpg_check_demo_mode_write_protect = tcm_qla2xxx_check_true, .tpg_check_prod_mode_write_protect = tcm_qla2xxx_check_false, + .tpg_check_demo_mode_login_only = tcm_qla2xxx_check_true, .tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl, .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl, .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index,
Signature · 1 line
1.7.2.5