: Complete conversion to generic REPORT_LUNS functionality
PATCH 1/2 : Complete conversion to generic REPORT_LUNS functionality
Greetings all,
This patch is made against lio-core-2.6.git/master
and tested on v2.6.28. 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
Thanks,
--nab
Quoted 1 line
From
01242e6614cc442b862c428d11fb593b1168b064Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Tue, 13 Jan 2009 12:56:48 -0800
Subject: [PATCH 1/2] [Target_Core_Mod]: Complete conversion to generic REPORT_LUNS functionality
This patch completes the $FABRIC_MOD independent conversion for REPORT_LUNS in v3.0 target_core_mod code. This patch removes the target_core_reportluns.[c,h] files all together, and adds the following:
I) Move REPORT_LUNS response emulation support to transport_core_report_lun_response() in target_core_device.c.
II) REPORT_LUNS support to transport_generic_cmd_sequencer()
III) New se_cmd_t->transport_emulate_cdb() to catch REPORT_LUNS in
__transport_execute_tasks()
Also, this patch fixes a BUG that was brought forward from v2.9 code for REPORT_LUNS response emulation where the following check:
spin_lock_bh(&SE_NODE_ACL(se_sess)->device_list_lock);
for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) {
deve = &SE_NODE_ACL(se_sess)->device_list[i];
if (!(deve->lun_flags & TRANSPORT_LUNFLAGS_INITIATOR_ACCESS))
continue;
se_lun = deve->se_lun;
/*
* We determine the correct LUN LIST LENGTH even once we
* have reached the initial allocation length.
* See SPC2-R20 7.19.
*/
lun_count++;
if ((cdb_offset + 8) > se_cmd->data_length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
continue;would overflow the REPORT_LUNS reponse buffer by 1 LUN Listing (8 bytes) when the cdb_offset + 8 exceeded the received data length. This patch correctly changes the conditional test to:
if ((cdb_offset + 8) >= se_cmd->data_length)
--- drivers/lio-core/Makefile | 1 - drivers/lio-core/target_core_base.h | 36 ++-- drivers/lio-core/target_core_device.c | 99 +++++++-- drivers/lio-core/target_core_device.h | 1 + drivers/lio-core/target_core_reportluns.c | 340 ----------------------------- drivers/lio-core/target_core_reportluns.h | 55 ----- drivers/lio-core/target_core_transport.c | 44 +++-- 7 files changed, 129 insertions(+), 447 deletions(-) delete mode 100644 drivers/lio-core/target_core_reportluns.c delete mode 100644 drivers/lio-core/target_core_reportluns.h
drivers/lio-core/Makefile +0 -1
@@ -33,7 +33,6 @@ target_core_mod-objs := target_core_configfs.o \ target_core_device.o \ target_core_hba.o \ target_core_plugin.o \ - target_core_reportluns.o \ target_core_scdb.o \ target_core_seobj.o \ target_core_tpg.o \
drivers/lio-core/target_core_base.h +18 -18
@@ -166,24 +166,23 @@#define TRANSPORT_FREE 255#define SCF_SUPPORTED_SAM_OPCODE 0x00000001 -#define SCF_REPORT_LUNS 0x00000002 -#define SCF_TRANSPORT_TASK_SENSE 0x00000004 -#define SCF_EMULATED_TASK_SENSE 0x00000008 -#define SCF_SCSI_DATA_SG_IO_CDB 0x00000010 -#define SCF_SCSI_CONTROL_SG_IO_CDB 0x00000020 -#define SCF_SCSI_CONTROL_NONSG_IO_CDB 0x00000040 -#define SCF_SCSI_NON_DATA_CDB 0x00000080 -#define SCF_SCSI_CDB_EXCEPTION 0x00000100 -#define SCF_SCSI_RESERVATION_CONFLICT 0x00000200 -#define SCF_CMD_PASSTHROUGH 0x00000400 -#define SCF_CMD_PASSTHROUGH_NOALLOC 0x00000800 -#define SCF_SE_CMD_FAILED 0x00001000 -#define SCF_SE_LUN_CMD 0x00002000 -#define SCF_SE_ALLOW_EOO 0x00004000 -#define SCF_SE_DISABLE_ONLINE_CHECK 0x00008000 -#define SCF_SENT_CHECK_CONDITION 0x00010000 -#define SCF_OVERFLOW_BIT 0x00020000 -#define SCF_UNDERFLOW_BIT 0x00040000 +#define SCF_TRANSPORT_TASK_SENSE 0x00000002 +#define SCF_EMULATED_TASK_SENSE 0x00000004 +#define SCF_SCSI_DATA_SG_IO_CDB 0x00000008 +#define SCF_SCSI_CONTROL_SG_IO_CDB 0x00000010 +#define SCF_SCSI_CONTROL_NONSG_IO_CDB 0x00000020 +#define SCF_SCSI_NON_DATA_CDB 0x00000040 +#define SCF_SCSI_CDB_EXCEPTION 0x00000080 +#define SCF_SCSI_RESERVATION_CONFLICT 0x00000100 +#define SCF_CMD_PASSTHROUGH 0x00000200 +#define SCF_CMD_PASSTHROUGH_NOALLOC 0x00000400 +#define SCF_SE_CMD_FAILED 0x00000800 +#define SCF_SE_LUN_CMD 0x00001000 +#define SCF_SE_ALLOW_EOO 0x00002000 +#define SCF_SE_DISABLE_ONLINE_CHECK 0x00004000 +#define SCF_SENT_CHECK_CONDITION 0x00008000 +#define SCF_OVERFLOW_BIT 0x00010000 +#define SCF_UNDERFLOW_BIT 0x00020000/* se_device_t->type */ #define PSCSI 1
@@ -414,6 +413,7 @@ typedef struct se_cmd_s {int (*transport_allocate_resources)(struct se_cmd_s *,u32 ,u32 );int (*transport_cdb_transform)(struct se_cmd_s *,struct se_transform_info_s *);int (*transport_do_transform)(struct se_cmd_s *,struct se_transform_info_s *); +int (*transport_emulate_cdb)(struct se_cmd_s *);void (*transport_free_resources)(struct se_cmd_s *);u32 (*transport_get_lba)(unsigned char *);unsigned long long (*transport_get_long_lba)(unsigned char *);
drivers/lio-core/target_core_device.c +82 -17
129 lines not on this page · raw message
drivers/lio-core/target_core_device.h +1 -0
@@ -40,6 +40,7 @@ extern void core_dec_lacl_count (struct se_node_acl_s *, struct se_cmd_s *);extern void core_update_device_list_access (u32 ,u32 ,se_node_acl_t *);extern void core_update_device_list_for_node (se_lun_t *lun,u32 ,u32 ,se_node_acl_t *,se_portal_group_t *,int );extern void core_clear_lun_from_tpg (se_lun_t *,se_portal_group_t *); +extern int transport_core_report_lun_response (se_cmd_t *);extern void se_release_device_for_hba (se_device_t *);extern void se_clear_dev_ports (se_device_t *);extern int se_free_virtual_device (se_device_t *,se_hba_t *);
drivers/lio-core/target_core_reportluns.c deleted +0 -340
340 lines not on this page · raw message
drivers/lio-core/target_core_reportluns.h deleted +0 -55
55 lines not on this page · raw message
drivers/lio-core/target_core_transport.c +28 -16
62 lines not on this page · raw message
Signature · 1 line
1.5.4.1