target: Pending fixes for v3.1-rc3
Subsystems (2)
cover target: Pending fixes for v3.1-rc3
From: Nicholas Bellinger <[email protected]>
Hello from LinuxCon,
The following is the current pending series of target fixes for -rc3 that includes a number of important bugfixes to what's currently in mainline -rc2. This big items are fixes for a handful of control CDBs broken during the big -rc1 merge, breakage with multi se_task support, and SGL chaining logic used by one in tree driver and a number of in-flight HW target mode drivers..
At this point there is still two outstanding issues not addressed in this series related to some recent NAA IEEE Registered Extended designator format breakage reported with VMFS, and breakage with LUN discovery in tcm_fc(fcoe) These bugs are still being discussed and addressed, and will be sent out in a seperate series.
These patches will be going to Linus in pull request form in the next days, so please have a look and let us know if anything needs more attention.
Thank you,
--nab
Chris Boot (1):
iscsi-target: Implement iSCSI target IPv6 address printing.
Dan Carpenter (3):
iscsi-target: remove duplicate return
iscsi-target: forever loop bug in iscsit_attach_ooo_cmdsn()
iscsi-target: Fix iscsit_allocate_se_cmd_for_tmr failure path bugs
Jesper Juhl (1):
iscsi-target: Fix leak on failure in iscsi_copy_param_list()
Julia Lawall (1):
target: Convert target_core_rd.c to use use BUG_ON
Nicholas Bellinger (10):
target: Change TCM_NON_EXISTENT_LUN response to ASC=LOGICAL UNIT NOT
SUPPORTED
target: Make standard INQUIRY return 'not connected' for
tpg_virt_lun0
target: Fix write payload exception handling with ->new_cmd_map
target: Add WRITE_SAME (10) parsing and refactor passthrough checks
target: Fix WRITE_SAME usage with transport_get_size
target: Remove duplicate task completions in
transport_emulate_control_cdb
target: Fix SYNCHRONIZE_CACHE zero LBA + range breakage
target: Add missing DATA_SG_IO transport_cmd_get_valid_sectors check
target: Fix task count > 1 handling breakage and use max_sector page
alignment
target: Fix task SGL chaining breakage with
transport_allocate_data_tasks
Roland Dreier (4):
target: Print subpage too for unhandled MODE SENSE pages
tcm_fc: init/exit functions should not be protected by "#ifdef
MODULE"
target: Make locking in transport_deregister_session() IRQ safe
target: Convert acl_node_lock to be IRQ-disabling
Thomas Meyer (1):
target: Use ERR_CAST inlined function
drivers/target/iscsi/iscsi_target.c | 1 - drivers/target/iscsi/iscsi_target_configfs.c | 4 +- drivers/target/iscsi/iscsi_target_erl1.c | 2 +- drivers/target/iscsi/iscsi_target_login.c | 16 +-- drivers/target/iscsi/iscsi_target_parameters.c | 43 ++--- drivers/target/iscsi/iscsi_target_util.c | 4 +- drivers/target/target_core_cdb.c | 57 ++++--- drivers/target/target_core_device.c | 44 ++++- drivers/target/target_core_fabric_configfs.c | 2 +- drivers/target/target_core_pr.c | 8 +- drivers/target/target_core_rd.c | 24 +-- drivers/target/target_core_tpg.c | 64 ++++---- drivers/target/target_core_transport.c | 206 ++++++++++++++---------- drivers/target/tcm_fc/tfc_conf.c | 6 +- include/target/target_core_fabric_ops.h | 6 + 15 files changed, 272 insertions(+), 215 deletions(-)
Signature · 1 line
1.7.6
PATCH 1/21 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
@@ -4726,6 +4726,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.6
PATCH 2/21 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
@@ -298,8 +298,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.6
PATCH 3/21 target: Use ERR_CAST inlined function
In reply to Nicholas A. BellingerFrom: Thomas Meyer <[email protected]>
Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
The semantic patch that makes this output is available in scripts/coccinelle/api/err_cast.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
--- drivers/target/iscsi/iscsi_target_configfs.c | 4 ++-- drivers/target/target_core_fabric_configfs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/target/iscsi/iscsi_target_configfs.c +2 -2
@@ -268,7 +268,7 @@ struct se_tpg_np *lio_target_call_addnptotpg( ISCSI_TCP);if (IS_ERR (tpg_np)) {iscsit_put_tpg (tpg); -return ERR_PTR (PTR_ERR (tpg_np)); +return ERR_CAST (tpg_np); }pr_debug ("LIO_Target_ConfigFS: addnptotpg done!\n" );
@@ -1285,7 +1285,7 @@ struct se_wwn *lio_target_call_coreaddtiqn( tiqn =iscsit_add_tiqn ((unsigned char *)name);if (IS_ERR (tiqn)) -return ERR_PTR (PTR_ERR (tiqn)); +return ERR_CAST (tiqn);/* * Setup struct iscsi_wwn_stat_grps for se_wwn->fabric_stat_group. */
drivers/target/target_core_fabric_configfs.c +1 -1
@@ -481,7 +481,7 @@ static struct config_group *target_fabric_make_nodeacl( se_nacl = tf->tf_ops.fabric_make_nodeacl (se_tpg, group, name);if (IS_ERR (se_nacl)) -return ERR_PTR (PTR_ERR (se_nacl)); +return ERR_CAST (se_nacl); nacl_cg = &se_nacl->acl_group; nacl_cg->default_groups = se_nacl->acl_default_groups;
Signature · 1 line
1.7.6
PATCH 4/21 iscsi-target: Fix leak on failure in iscsi_copy_param_list()
In reply to Nicholas A. BellingerFrom: Jesper Juhl <[email protected]>
We leak memory if the allocations for 'new_param->name' or 'new_param->value' fail in iscsi_target_parameters.c::iscsi_copy_param_list()
We also do a lot of variable assignments that are completely pointless if the allocations fail.
So, let's move the allocations before the assignments and also make sure that we free whatever was allocated to one if the allocation fail.
There's also some small CodingStyle fixups in there (curly braces on both branches of if statement, only one variable per line) since I was in the area anyway. And finally, error messages in the function are put on a single line for easy grep'abillity.
--- drivers/target/iscsi/iscsi_target_parameters.c | 43 +++++++++--------------- 1 files changed, 16 insertions(+), 27 deletions(-)
drivers/target/iscsi/iscsi_target_parameters.c +16 -27
@@ -545,13 +545,13 @@ int iscsi_copy_param_list( struct iscsi_param_list *src_param_list, int leading) { -struct iscsi_param *new_param =NULL , *param =NULL ; +struct iscsi_param *param =NULL ; +struct iscsi_param *new_param =NULL ;struct iscsi_param_list *param_list =NULL ; param_list =kzalloc (sizeof (struct iscsi_param_list ),GFP_KERNEL );if (!param_list) { -pr_err ("Unable to allocate memory for" -" struct iscsi_param_list.\n" ); +pr_err ("Unable to allocate memory for struct iscsi_param_list.\n" ); goto err_out; }INIT_LIST_HEAD (¶m_list->param_list);
@@ -567,8 +567,17 @@ int iscsi_copy_param_list( new_param =kzalloc (sizeof (struct iscsi_param ),GFP_KERNEL );if (!new_param) { -pr_err ("Unable to allocate memory for" -" struct iscsi_param.\n" ); +pr_err ("Unable to allocate memory for struct iscsi_param.\n" ); + goto err_out; + } + + new_param->name =kstrdup (param->name,GFP_KERNEL ); + new_param->value =kstrdup (param->value,GFP_KERNEL ); +if (!new_param->value || !new_param->name) { +kfree (new_param->value); +kfree (new_param->name); +kfree (new_param); +pr_err ("Unable to allocate memory for parameter name/value.\n" ); goto err_out; }
@@ -580,32 +589,12 @@ int iscsi_copy_param_list( new_param->use = param->use; new_param->type_range = param->type_range; - new_param->name =kzalloc (strlen (param->name) +1 ,GFP_KERNEL ); -if (!new_param->name) { -pr_err ("Unable to allocate memory for" -" parameter name.\n" ); - goto err_out; - } - - new_param->value =kzalloc (strlen (param->value) +1 , -GFP_KERNEL ); -if (!new_param->value) { -pr_err ("Unable to allocate memory for" -" parameter value.\n" ); - goto err_out; - } - -memcpy (new_param->name, param->name,strlen (param->name)); - new_param->name[strlen (param->name)] ='\0' ; -memcpy (new_param->value, param->value,strlen (param->value)); - new_param->value[strlen (param->value)] ='\0' ; -list_add_tail (&new_param->p_list, ¶m_list->param_list); } -if (!list_empty (¶m_list->param_list)) +if (!list_empty (¶m_list->param_list)) { *dst_param_list = param_list; -else { + }else {pr_err ("No parameters allocated.\n" ); goto err_out; }
Signature · 1 line
1.7.6
PATCH 5/21 target: Convert target_core_rd.c to use use BUG_ON
In reply to Nicholas A. BellingerFrom: Julia Lawall <[email protected]>
Use BUG_ON(x) rather than if(x) BUG();
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@ identifier x; @@
-if (x) BUG();
+BUG_ON(x);
@@ identifier x; @@
-if (!x) BUG();
+BUG_ON(!x);
// </smpl>
--- drivers/target/target_core_rd.c | 24 ++++++++---------------- 1 files changed, 8 insertions(+), 16 deletions(-)
drivers/target/target_core_rd.c +8 -16
@@ -390,12 +390,10 @@ static int rd_MEMCPY_read(struct rd_request *req) length = req->rd_size; dst =sg_virt (&sg_d[i++]) + dst_offset; -if (!dst) -BUG (); +BUG_ON (!dst); src =sg_virt (&sg_s[j]) + src_offset; -if (!src) -BUG (); +BUG_ON (!src); dst_offset =0 ; src_offset = length;
@@ -415,8 +413,7 @@ static int rd_MEMCPY_read(struct rd_request *req) length = req->rd_size; dst =sg_virt (&sg_d[i]) + dst_offset; -if (!dst) -BUG (); +BUG_ON (!dst);if (sg_d[i].length == length) { i++;
@@ -425,8 +422,7 @@ static int rd_MEMCPY_read(struct rd_request *req) dst_offset = length; src =sg_virt (&sg_s[j++]) + src_offset; -if (!src) -BUG (); +BUG_ON (!src); src_offset =0 ; page_end =1 ;
@@ -510,12 +506,10 @@ static int rd_MEMCPY_write(struct rd_request *req) length = req->rd_size; src =sg_virt (&sg_s[i++]) + src_offset; -if (!src) -BUG (); +BUG_ON (!src); dst =sg_virt (&sg_d[j]) + dst_offset; -if (!dst) -BUG (); +BUG_ON (!dst); src_offset =0 ; dst_offset = length;
@@ -535,8 +529,7 @@ static int rd_MEMCPY_write(struct rd_request *req) length = req->rd_size; src =sg_virt (&sg_s[i]) + src_offset; -if (!src) -BUG (); +BUG_ON (!src);if (sg_s[i].length == length) { i++;
@@ -545,8 +538,7 @@ static int rd_MEMCPY_write(struct rd_request *req) src_offset = length; dst =sg_virt (&sg_d[j++]) + dst_offset; -if (!dst) -BUG (); +BUG_ON (!dst); dst_offset =0 ; page_end =1 ;
Signature · 1 line
1.7.6
PATCH 6/21 iscsi-target: remove duplicate return
In reply to Nicholas A. BellingerFrom: Dan Carpenter <[email protected]>
We returned on the line before already.
--- drivers/target/iscsi/iscsi_target.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/target/iscsi/iscsi_target.c +0 -1
@@ -2243,7 +2243,6 @@ static int iscsit_handle_snack(case 0 :return iscsit_handle_recovery_datain_or_r2t (conn, buf, hdr->itt, hdr->ttt, hdr->begrun, hdr->runlength); -return 0 ;case ISCSI_FLAG_SNACK_TYPE_STATUS :return iscsit_handle_status_snack (conn, hdr->itt, hdr->ttt, hdr->begrun, hdr->runlength);
Signature · 1 line
1.7.6
PATCH 7/21 iscsi-target: forever loop bug in iscsit_attach_ooo_cmdsn()
In reply to Nicholas A. BellingerFrom: Dan Carpenter <[email protected]>
This patch fixes a forever loop bug in iscsit_attach_ooo_cmdsn() while walking sess->sess_ooo_cmdsn_list when the received CmdSN is less than the tail of the list.
--- drivers/target/iscsi/iscsi_target_erl1.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/target/iscsi/iscsi_target_erl1.c +1 -1
@@ -834,7 +834,7 @@ static int iscsit_attach_ooo_cmdsn(*/ list_for_each_entry (ooo_tmp, &sess->sess_ooo_cmdsn_list, ooo_list) { -while (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn) +if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn)continue ; list_add(&ooo_cmdsn->ooo_list,
Signature · 1 line
1.7.6
PATCH 8/21 target: Fix write payload exception handling with ->new_cmd_map
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch fixes a bug for fabrics using tfo->new_cmd_map() that are expect transport_generic_request_failure() to be calling transport_send_check_condition_and_sense() for both READ and WRITE, instead of only for READ exceptions.
This was originally observed with a failed WRITE_SAME_16 w/ unmap=0 using tcm_loop.
--- drivers/target/target_core_transport.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/target/target_core_transport.c +8 -2
@@ -2053,8 +2053,14 @@ static void transport_generic_request_failure( cmd->scsi_sense_reason =TCM_UNSUPPORTED_SCSI_OPCODE ;break ; } - -if (!sc) +/* +* If a fabric does not define a cmd->se_tfo->new_cmd_map caller, +* make the call to transport_send_check_condition_and_sense() +* directly. Otherwise expect the fabric to make the call to +* transport_send_check_condition_and_sense() after handling +* possible unsoliticied write data payloads. +*/ +if (!sc && !cmd->se_tfo->new_cmd_map)transport_new_cmd_failure (cmd);else { ret = transport_send_check_condition_and_sense(cmd,
Signature · 1 line
1.7.6
PATCH 9/21 target: Add WRITE_SAME (10) parsing and refactor passthrough checks
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch adds initial WRITE_SAME (10) w/ UNMAP=1 support following updates in sbcr26 to allow UNMAP=1 for the non 16 + 32 byte CDB case. It also refactors current pSCSI passthrough passthrough checks into target_check_write_same_discard() ahead of UNMAP=0 w/ write payload support into target_core_iblock.c.
This includes the support for handling WRITE_SAME in transport_emulate_control_cdb(), and converts target_emulate_write_same to accept num_blocks directly for WRITE_SAME, WRITE_SAME_16 and WRITE_SAME_32.
--- drivers/target/target_core_cdb.c | 28 +++++---- drivers/target/target_core_transport.c | 102 ++++++++++++++++++-------------- 2 files changed, 73 insertions(+), 57 deletions(-)
drivers/target/target_core_cdb.c +16 -12
@@ -1090,24 +1090,17 @@ err:* Note this is not used for TCM/pSCSI passthrough */ static int -target_emulate_write_same (struct se_task *task,int write_same32) +target_emulate_write_same (struct se_task *task,u32 num_blocks) {struct se_cmd *cmd = task->task_se_cmd;struct se_device *dev = cmd->se_dev;sector_t range;sector_t lba = cmd->t_task_lba; -unsigned int num_blocks;int ret;/* -* Extract num_blocks from the WRITE_SAME_* CDB. Then use the explict -* range when non zero is supplied, otherwise calculate the remaining -* range based on ->get_blocks() - starting LBA. +* Use the explicit range when non zero is supplied, otherwise calculate +* the remaining range based on ->get_blocks() - starting LBA. */ -if (write_same32) - num_blocks =get_unaligned_be32 (&cmd->t_task_cdb[28 ]); -else - num_blocks =get_unaligned_be32 (&cmd->t_task_cdb[10 ]); -if (num_blocks !=0 ) range = num_blocks;else
@@ -1170,13 +1163,23 @@ transport_emulate_control_cdb(struct se_task *task) } ret =target_emulate_unmap (task);break ; +case WRITE_SAME : +if (!dev->transport->do_discard) { +pr_err ("WRITE_SAME emulation not supported" +" for: %s\n" , dev->transport->name); +return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE ; + } + ret =target_emulate_write_same (task, +get_unaligned_be16 (&cmd->t_task_cdb[7 ])); +break ;case WRITE_SAME_16 :if (!dev->transport->do_discard) {pr_err ("WRITE_SAME_16 emulation not supported" " for: %s\n" , dev->transport->name);return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE ; } - ret =target_emulate_write_same (task,0 ); + ret =target_emulate_write_same (task, +get_unaligned_be32 (&cmd->t_task_cdb[10 ]));break ;case VARIABLE_LENGTH_CMD : service_action =
@@ -1189,7 +1192,8 @@ transport_emulate_control_cdb(struct se_task *task) dev->transport->name);return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE ; } - ret =target_emulate_write_same (task,1 ); + ret =target_emulate_write_same (task, +get_unaligned_be32 (&cmd->t_task_cdb[28 ]));break ;default : pr_err("Unsupported VARIABLE_LENGTH_CMD SA:"
drivers/target/target_core_transport.c +57 -45
123 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 10/21 target: Fix WRITE_SAME usage with transport_get_size
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
For all flavours of WRITE_SAME, we only expect to handle a single block of data-out buffer payload, regardless of the number of logical blocks presented in the CDB. This patch changes all flavours of WRITE_SAME in transport_generic_cmd_sequencer() to pass '1' into transport_get_size() instead of the extracted 'sectors' to properly handle the default usage of sg_write_same without the --xferlen parameter.
--- drivers/target/target_core_transport.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/target/target_core_transport.c +3 -3
@@ -3103,7 +3103,7 @@ static int transport_generic_cmd_sequencer( goto out_unsupported_cdb;if (sectors) - size =transport_get_size (sectors, cdb, cmd); + size =transport_get_size (1 , cdb, cmd);else {pr_err ("WSNZ=1, WRITE_SAME w/sectors=0 not" " supported\n" );
@@ -3365,7 +3365,7 @@ static int transport_generic_cmd_sequencer( goto out_unsupported_cdb;if (sectors) - size =transport_get_size (sectors, cdb, cmd); + size =transport_get_size (1 , cdb, cmd);else {pr_err ("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n" ); goto out_invalid_cdb_field;
@@ -3383,7 +3383,7 @@ static int transport_generic_cmd_sequencer( goto out_unsupported_cdb;if (sectors) - size =transport_get_size (sectors, cdb, cmd); + size =transport_get_size (1 , cdb, cmd);else {pr_err ("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n" ); goto out_invalid_cdb_field;
Signature · 1 line
1.7.6
PATCH 11/21 target: Remove duplicate task completions in transport_emulate_control_cdb
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch removes a duplicate set of transport_complete_task() calls in target_emulate_unmap() and target_emulate_write_same() as the completion call is already done within transport_emulate_control_cdb()
This patch also adds a check in transport_emulate_control_cdb() for the existing SCF_EMULATE_CDB_ASYNC flag currently used by SYNCHRONIZE_CACHE in order to handle IMMEDIATE processing.
--- drivers/target/target_core_cdb.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/target/target_core_cdb.c +8 -6
@@ -1077,8 +1077,6 @@ target_emulate_unmap(struct se_task *task) size -=16 ; } - task->task_scsi_status =GOOD ; -transport_complete_task (task,1 ); err:transport_kunmap_first_data_page (cmd);
@@ -1115,8 +1113,6 @@ target_emulate_write_same(struct se_task *task, u32 num_blocks)return ret; } - task->task_scsi_status =GOOD ; -transport_complete_task (task,1 );return 0 ; }
@@ -1228,8 +1224,14 @@ transport_emulate_control_cdb(struct se_task *task)if (ret <0 )return ret; - task->task_scsi_status =GOOD ; -transport_complete_task (task,1 ); +/* +* Handle the successful completion here unless a caller +* has explictly requested an asychronous completion. +*/ +if (!(cmd->se_cmd_flags &SCF_EMULATE_CDB_ASYNC )) { + task->task_scsi_status =GOOD ; +transport_complete_task (task,1 ); + }return PYX_TRANSPORT_SENT_TO_TRANSPORT ; }
Signature · 1 line
1.7.6
PATCH 12/21 target: Fix SYNCHRONIZE_CACHE zero LBA + range breakage
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch fixes a SYNCHRONIZE_CACHE CDB handling bug with IBLOCK/FILEIO backends where transport_cmd_get_valid_sectors() was incorrectly rejecting a zero LBA + range CDB from being processed, and returning CHECK_CONDITION.
This includes changing transport_cmd_get_valid_sectors() to return '0' on success and '-EINVAL' on failure (this makes more sense than sectors), and to only check transport_cmd_get_valid_sectors() when a non zero LBA + range SYNCHRONIZE_CACHE operation has been receieved for the non passthrough case.
--- drivers/target/target_core_transport.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/target/target_core_transport.c +7 -7
@@ -2853,12 +2853,10 @@ static int transport_cmd_get_valid_sectors(struct se_cmd *cmd)" transport_dev_end_lba(): %llu\n" , cmd->t_task_lba, sectors, transport_dev_end_lba(dev)); -pr_err (" We should return CHECK_CONDITION" -" but we don't yet\n" ); -return 0 ; +return -EINVAL ; } -return sectors; +return 0 ; }static int target_check_write_same_discard (unsigned char *flags,struct se_device *dev)
@@ -3350,10 +3348,12 @@ static int transport_generic_cmd_sequencer( cmd->se_cmd_flags |=SCF_EMULATE_CDB_ASYNC ;/* * Check to ensure that LBA + Range does not exceed past end of -* device. +* device for IBLOCK and FILEIO ->do_sync_cache() backend calls */ -if (!transport_cmd_get_valid_sectors (cmd)) - goto out_invalid_cdb_field; +if ((cmd->t_task_lba !=0 ) || (sectors !=0 )) { +if (transport_cmd_get_valid_sectors (cmd) <0 ) + goto out_invalid_cdb_field; + }break ;case UNMAP : size =get_unaligned_be16 (&cdb[7 ]);
Signature · 1 line
1.7.6
PATCH 13/21 target: Add missing DATA_SG_IO transport_cmd_get_valid_sectors check
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch adds the missing transport_cmd_get_valid_sectors() check for SCF_SCSI_DATA_SG_IO_CDB type payloads to ensure that a received LBA + range does not exeed past the end of associated backend struct se_device.
This patch also fixes a bug in the failure path of transport_new_cmd_obj() where this check can fail, so change to use a signed 'rc' and return '-EINVAL' to signal proper transport_generic_request_failure() handling.
--- drivers/target/target_core_transport.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
drivers/target/target_core_transport.c +8 -7
@@ -3891,9 +3891,7 @@ EXPORT_SYMBOL(transport_generic_map_mem_to_cmd);static int transport_new_cmd_obj (struct se_cmd *cmd) {struct se_device *dev = cmd->se_dev; -u32 task_cdbs; -u32 rc; -int set_counts =1 ; +int set_counts =1 , rc, task_cdbs;/* * Setup any BIDI READ tasks and memory from
@@ -3911,7 +3909,7 @@ static int transport_new_cmd_obj(struct se_cmd *cmd) cmd->se_cmd_flags |=SCF_SCSI_CDB_EXCEPTION ; cmd->scsi_sense_reason =TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ; -return PYX_TRANSPORT_LU_COMM_FAILURE ; +return -EINVAL ; }atomic_inc (&cmd->t_fe_count);atomic_inc (&cmd->t_se_count);
@@ -3930,7 +3928,7 @@ static int transport_new_cmd_obj(struct se_cmd *cmd) cmd->se_cmd_flags |=SCF_SCSI_CDB_EXCEPTION ; cmd->scsi_sense_reason =TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ; -return PYX_TRANSPORT_LU_COMM_FAILURE ; +return -EINVAL ; }if (set_counts) {
@@ -4248,10 +4246,13 @@ static u32 transport_allocate_tasks( struct scatterlist *sgl, unsigned int sgl_nents) { -if (cmd->se_cmd_flags &SCF_SCSI_DATA_SG_IO_CDB ) +if (cmd->se_cmd_flags &SCF_SCSI_DATA_SG_IO_CDB ) { +if (transport_cmd_get_valid_sectors (cmd) <0 ) +return -EINVAL ; +return transport_allocate_data_tasks (cmd, lba, data_direction, sgl, sgl_nents); -else + }else return transport_allocate_control_task (cmd); }
Signature · 1 line
1.7.6
PATCH 14/21 target: Fix task count > 1 handling breakage and use max_sector page alignment
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch addresses recent breakage with multiple se_task (task_count > 1) operation following backend dev->se_sub_dev->se_dev_attrib.max_sectors in new transport_allocate_data_tasks() code. The initial bug here was a bogus task->task_sg_nents assignment in transport_allocate_data_tasks() based on the passed parameter, which now uses DIV_ROUND_UP(task_size, PAGE_SIZE) to determine the proper number of per task SGL entries for the (task_count > 1) case.
This also means we now need to enforce a PAGE_SIZE aligned max_sector count value for this to work as expected without bringing back the pre v3.1 transport_map_mem_to_sg() logic to handle SGL offsets across multiple tasks. So this patch adds se_dev_align_max_sectors() to round down max_sectors as necessary to ensure this alignment via se_dev_set_default_attribs() and se_dev_align_max_sectors() and keeps it simple for (task_count > 1) operation.
So far this bugfix has been tested with (task_count > 1) operation using iscsi-target and iblock backends.
--- drivers/target/target_core_device.c | 28 ++++++++++++++++++++++++++++ drivers/target/target_core_transport.c | 7 +++++-- 2 files changed, 33 insertions(+), 2 deletions(-)
drivers/target/target_core_device.c +28 -0
@@ -839,6 +839,24 @@ int se_dev_check_shutdown(struct se_device *dev)return ret; } +u32 se_dev_align_max_sectors (u32 max_sectors,u32 block_size) +{ +u32 tmp, aligned_max_sectors; +/* +* Limit max_sectors to a PAGE_SIZE aligned value for modern +* transport_allocate_data_tasks() operation. +*/ + tmp =rounddown ((max_sectors * block_size),PAGE_SIZE ); + aligned_max_sectors = (tmp / block_size); +if (max_sectors != aligned_max_sectors) { +printk (KERN_INFO "Rounding down aligned max_sectors from %u" +" to %u\n" , max_sectors, aligned_max_sectors); +return aligned_max_sectors; + } + +return max_sectors; +} +void se_dev_set_default_attribs (struct se_device *dev,struct se_dev_limits *dev_limits)
@@ -878,6 +896,11 @@ void se_dev_set_default_attribs(* max_sectors is based on subsystem plugin dependent requirements. */ dev->se_sub_dev->se_dev_attrib.hw_max_sectors = limits->max_hw_sectors; +/* +* Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() +*/ + limits->max_sectors =se_dev_align_max_sectors (limits->max_sectors, + limits->logical_block_size); dev->se_sub_dev->se_dev_attrib.max_sectors = limits->max_sectors;/* * Set optimal_sectors from max_sectors, which can be lowered via
@@ -1242,6 +1265,11 @@ int se_dev_set_max_sectors(struct se_device *dev, u32 max_sectors)return -EINVAL ; } } +/* +* Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() +*/ + max_sectors =se_dev_align_max_sectors (max_sectors, + dev->se_sub_dev->se_dev_attrib.block_size); dev->se_sub_dev->se_dev_attrib.max_sectors = max_sectors; pr_debug("dev[%p]: SE Device max_sectors changed to %u\n",
drivers/target/target_core_transport.c +5 -2
@@ -4126,7 +4126,11 @@ static int transport_allocate_data_tasks(/* Update new cdb with updated lba/sectors */ cmd->transport_split_cdb (task->task_lba, task->task_sectors, cdb); - +/* +* This now assumes that passed sg_ents are in PAGE_SIZE chunks +* in order to calculate the number per task SGL entries +*/ + task->task_sg_nents =DIV_ROUND_UP (task->task_size,PAGE_SIZE );/* * Check if the fabric module driver is requesting that all * struct se_task->task_sg[] be chained together.. If so,
@@ -4136,7 +4140,6 @@ static int transport_allocate_data_tasks(* It's so much easier and only a waste when task_count > 1. * That is extremely rare. */ - task->task_sg_nents = sgl_nents;if (cmd->se_tfo->task_sg_chaining) { task->task_sg_nents++; task->task_padded_sg =1 ;
Signature · 1 line
1.7.6
PATCH 15/21 target: Fix task SGL chaining breakage with transport_allocate_data_tasks
In reply to Nicholas A. BellingerFrom: Nicholas Bellinger <[email protected]>
This patch fixes two bugs associated with transport_do_task_sg_chain() operation where transport_allocate_data_tasks() was incorrectly setting task_padded_sg for all tasks, and causing bogus task->task_sg_nents assignments + OOPsen with fabrics depending upon this code. The first bit here adds a task_sg_nents_padded check in transport_allocate_data_tasks() to include an extra SGL vector when necessary for tasks that expect to be linked using sg_chain().
The second change involves making transport_do_task_sg_chain() properly account for the extra SGL vector when task->task_padded_sg is set for the non trailing ->task_sg or single ->task_sg allocations. Note this patch also removes the BUG_ON(!task->task_padded_sg) check within transport_do_task_sg_chain() as we expect this to happen normally with the updated logic in transport_allocate_data_tasks(), along with being bogus for CONTROL_SG_IO_CDB type payloads.
So far this bugfix has been tested with tcm_qla2xxx and iblock backends in (task_count > 1)( and (task_count == 1) operation.
--- drivers/target/target_core_transport.c | 34 +++++++++++++++++++------------ 1 files changed, 21 insertions(+), 13 deletions(-)
drivers/target/target_core_transport.c +21 -13
@@ -4044,8 +4044,6 @@ void transport_do_task_sg_chain(struct se_cmd *cmd)if (!task->task_sg)continue ; -BUG_ON (!task->task_padded_sg); -if (!sg_first) { sg_first = task->task_sg; chained_nents = task->task_sg_nents;
@@ -4053,9 +4051,19 @@ void transport_do_task_sg_chain(struct se_cmd *cmd)sg_chain (sg_prev, sg_prev_nents, task->task_sg); chained_nents += task->task_sg_nents; } +/* +* For the padded tasks, use the extra SGL vector allocated +* in transport_allocate_data_tasks() for the sg_prev_nents +* offset into sg_chain() above.. The last task of a +* multi-task list, or a single task will not have +* task->task_sg_padded set.. +*/ +if (task->task_padded_sg) + sg_prev_nents = (task->task_sg_nents +1 ); +else + sg_prev_nents = task->task_sg_nents; sg_prev = task->task_sg; - sg_prev_nents = task->task_sg_nents; }/* * Setup the starting pointer and total t_tasks_sg_linked_no including
@@ -4107,7 +4115,7 @@ static int transport_allocate_data_tasks( cmd_sg = sgl;for (i =0 ; i < task_count; i++) { -unsigned int task_size; +unsigned int task_size, task_sg_nents_padded;int count; task =transport_generic_get_task (cmd, data_direction);
@@ -4135,24 +4143,24 @@ static int transport_allocate_data_tasks(* Check if the fabric module driver is requesting that all * struct se_task->task_sg[] be chained together.. If so, * then allocate an extra padding SG entry for linking and -* marking the end of the chained SGL. -* Possibly over-allocate task sgl size by using cmd sgl size. -* It's so much easier and only a waste when task_count > 1. -* That is extremely rare. +* marking the end of the chained SGL for every task except +* the last one for (task_count > 1) operation, or skipping +* the extra padding for the (task_count == 1) case. */ -if (cmd->se_tfo->task_sg_chaining) { - task->task_sg_nents++; +if (cmd->se_tfo->task_sg_chaining && (i < (task_count -1 ))) { + task_sg_nents_padded = (task->task_sg_nents +1 ); task->task_padded_sg =1 ; - } + }else + task_sg_nents_padded = task->task_sg_nents; task->task_sg =kmalloc (sizeof (struct scatterlist ) * - task->task_sg_nents,GFP_KERNEL ); + task_sg_nents_padded,GFP_KERNEL );if (!task->task_sg) { cmd->se_dev->transport->free_task (task);return -ENOMEM ; } -sg_init_table (task->task_sg, task->task_sg_nents); +sg_init_table (task->task_sg, task_sg_nents_padded); task_size = task->task_size;
Signature · 1 line
1.7.6
PATCH 16/21 iscsi-target: Implement iSCSI target IPv6 address printing.
In reply to Nicholas A. BellingerFrom: Chris Boot <[email protected]>
The iSCSI target configfs code to print out an initiator's IPv6 address is not fully implemented. This patch uses snprintf() with the "%pI6c" format string to format the IPv6 address for display purposes.
--- drivers/target/iscsi/iscsi_target_login.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)
drivers/target/iscsi/iscsi_target_login.c +3 -13
@@ -1013,19 +1013,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) ISCSI_LOGIN_STATUS_TARGET_ERROR); goto new_sess_out; } -#if 0 -if (!iscsi_ntop6 ((const unsigned char *) - &sock_in6.sin6_addr.in6_u, - (char *)&conn->ipv6_login_ip[0 ], -IPV6_ADDRESS_SPACE )) { -pr_err ("iscsi_ntop6() failed\n" ); -iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR , -ISCSI_LOGIN_STATUS_TARGET_ERROR ); - goto new_sess_out; - } -#else -pr_debug ("Skipping iscsi_ntop6()\n" ); -#endif +snprintf (conn->login_ip,sizeof (conn->login_ip),"%pI6c" , + &sock_in6.sin6_addr.in6_u); + conn->login_port =ntohs (sock_in6.sin6_port); }else {memset (&sock_in,0 ,sizeof (struct sockaddr_in ));
Signature · 1 line
1.7.6
PATCH 17/21 iscsi-target: Fix iscsit_allocate_se_cmd_for_tmr failure path bugs
In reply to Nicholas A. BellingerFrom: Dan Carpenter <[email protected]>
This patch fixes two bugs in allocation failure handling in iscsit_allocate_se_cmd_for_tmr():
This first reported by DanC is a free-after call to transport_free_se_cmd(), this patch drops the transport_free_se_cmd() call all together, as iscsit_release_cmd() will release existing allocations as expected.
The second is a bug where iscsi_cmd_t was being leaked on a cmd->tmr_req allocation failure, so make this jump to iscsit_release_cmd() as well.
--- drivers/target/iscsi/iscsi_target_util.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/target/iscsi/iscsi_target_util.c +1 -3
@@ -243,7 +243,7 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr(if (!cmd->tmr_req) {pr_err ("Unable to allocate memory for" " Task Management command!\n" ); -return NULL ; + goto out; }/* * TASK_REASSIGN for ERL=2 / connection stays inside of
@@ -298,8 +298,6 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr(return cmd; out:iscsit_release_cmd (cmd); -if (se_cmd) -transport_free_se_cmd (se_cmd);return NULL ; }
Signature · 1 line
1.7.6
PATCH 18/21 target: Print subpage too for unhandled MODE SENSE pages
In reply to Nicholas A. BellingerFrom: Roland Dreier <[email protected]>
Make a log message more useful by printing both the page and subpage that an initiator is requesting.
--- drivers/target/target_core_cdb.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/target/target_core_cdb.c +2 -2
@@ -920,8 +920,8 @@ target_emulate_modesense(struct se_cmd *cmd, int ten) length +=target_modesense_control (dev, &buf[offset+length]);break ;default : -pr_err ("Got Unknown Mode Page: 0x%02x\n" , - cdb[2 ] &0x3f ); +pr_err ("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n" , + cdb[2 ] &0x3f , cdb[3 ]);return PYX_TRANSPORT_UNKNOWN_MODE_PAGE ; } offset += length;
Signature · 1 line
1.7.6
PATCH 19/21 tcm_fc: init/exit functions should not be protected by "#ifdef MODULE"
In reply to Nicholas A. BellingerFrom: Roland Dreier <[email protected]>
There's no need for the #ifdef protection when building into the kernel, and in fact we need the module_init() for the initialization function to be called.
--- drivers/target/tcm_fc/tfc_conf.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/target/tcm_fc/tfc_conf.c +0 -2
@@ -655,9 +655,7 @@ static void __exit ft_exit(void)synchronize_rcu (); } -#ifdef MODULE MODULE_DESCRIPTION ("FC TCM fabric driver " FT_VERSION );MODULE_LICENSE ("GPL" );module_init (ft_init);module_exit (ft_exit); -#endif /* MODULE */
Signature · 1 line
1.7.6
PATCH 20/21 target: Make locking in transport_deregister_session() IRQ safe
In reply to Nicholas A. BellingerFrom: Roland Dreier <[email protected]>
At least the tcm_qla2xxx fabric driver calls into transport_deregister_session() while holding an IRQ-disabled spinlock, so the inner locking needs to use spin_lock_irqsave() instead of spin_lock_bh().
This fixes warnings seen with tcm_qla2xxx like:
WARNING: at kernel/softirq.c:159 local_bh_enable_ip+0x98/0xb0()
Call Trace:
[<ffffffff8104e65f>] warn_slowpath_common+0x7f/0xc0
[<ffffffff8104e6ba>] warn_slowpath_null+0x1a/0x20
[<ffffffff81055368>] local_bh_enable_ip+0x98/0xb0
[<ffffffff814d5284>] _raw_spin_unlock_bh+0x14/0x20
[<ffffffffa027b7f6>] transport_deregister_session+0x96/0x180 [target_core_mod]
[<ffffffffa00f7731>] tcm_qla2xxx_free_session+0xd1/0x170 [tcm_qla2xxx]
[<ffffffffa01b9173>] qla_tgt_sess_put+0xc3/0x140 [qla2xxx]
[<ffffffffa01bf40f>] qla_tgt_stop_phase1+0x8f/0x2c0 [qla2xxx]
[<ffffffffa00f735e>] tcm_qla2xxx_tpg_store_enable+0x6e/0xd0 [tcm_qla2xxx]
[<ffffffffa026ca29>] target_fabric_tpg_attr_store+0x39/0x40 [target_core_mod]
[<ffffffffa00a575d>] configfs_write_file+0xbd/0x120 [configfs]
[<ffffffff811464a6>] vfs_write+0xc6/0x180
[<ffffffff811467c1>] sys_write+0x51/0x90
[<ffffffff814dd382>] system_call_fastpath+0x16/0x1b--- drivers/target/target_core_transport.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
drivers/target/target_core_transport.c +7 -6
@@ -389,17 +389,18 @@ void transport_deregister_session(struct se_session *se_sess) {struct se_portal_group *se_tpg = se_sess->se_tpg;struct se_node_acl *se_nacl; +unsigned long flags;if (!se_tpg) {transport_free_session (se_sess);return ; } -spin_lock_bh (&se_tpg->session_lock); +spin_lock_irqsave (&se_tpg->session_lock, flags);list_del (&se_sess->sess_list); se_sess->se_tpg =NULL ; se_sess->fabric_sess_ptr =NULL ; -spin_unlock_bh (&se_tpg->session_lock); +spin_unlock_irqrestore (&se_tpg->session_lock, flags);/* * Determine if we need to do extra work for this initiator node's
@@ -407,22 +408,22 @@ void transport_deregister_session(struct se_session *se_sess)*/ se_nacl = se_sess->se_node_acl;if (se_nacl) { -spin_lock_bh (&se_tpg->acl_node_lock); +spin_lock_irqsave (&se_tpg->acl_node_lock, flags);if (se_nacl->dynamic_node_acl) {if (!se_tpg->se_tpg_tfo->tpg_check_demo_mode_cache ( se_tpg)) {list_del (&se_nacl->acl_list); se_tpg->num_node_acls--; -spin_unlock_bh (&se_tpg->acl_node_lock); +spin_unlock_irqrestore (&se_tpg->acl_node_lock, flags);core_tpg_wait_for_nacl_pr_ref (se_nacl);core_free_device_list_for_node (se_nacl, se_tpg); se_tpg->se_tpg_tfo->tpg_release_fabric_acl (se_tpg, se_nacl); -spin_lock_bh (&se_tpg->acl_node_lock); +spin_lock_irqsave (&se_tpg->acl_node_lock, flags); } } -spin_unlock_bh (&se_tpg->acl_node_lock); +spin_unlock_irqrestore (&se_tpg->acl_node_lock, flags); }transport_free_session (se_sess);
Signature · 1 line
1.7.6
PATCH 21/21 target: Convert acl_node_lock to be IRQ-disabling
In reply to Nicholas A. BellingerFrom: Roland Dreier <[email protected]>
With qla2xxx, acl_node_lock is taken inside qla2xxx's hardware_lock, which is taken in hardirq context. This means acl_node_lock must become an IRQ-disabling lock; in particular this fixes lockdep warnings along the lines of
======================================================
[ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ]
(&(&se_tpg->acl_node_lock)->rlock){+.....}, at: [<ffffffffa026f872>] transport_deregister_session+0x92/0x140 [target_core_mod]
and this task is already holding:
(&(&ha->hardware_lock)->rlock){-.-...}, at: [<ffffffffa017c5e7>] qla_tgt_stop_phase1+0x57/0x2c0 [qla2xxx]
which would create a new lock dependency:
(&(&ha->hardware_lock)->rlock){-.-...} -> (&(&se_tpg->acl_node_lock)->rlock){+.....}
but this new dependency connects a HARDIRQ-irq-safe lock:
(&(&ha->hardware_lock)->rlock){-.-...}
to a HARDIRQ-irq-unsafe lock:
(&(&se_tpg->acl_node_lock)->rlock){+.....}--- drivers/target/target_core_device.c | 16 +++++----- drivers/target/target_core_pr.c | 8 +++--- drivers/target/target_core_tpg.c | 52 +++++++++++++++++----------------- drivers/target/tcm_fc/tfc_conf.c | 4 +- 4 files changed, 40 insertions(+), 40 deletions(-)
drivers/target/target_core_device.c +8 -8
@@ -472,9 +472,9 @@ void core_clear_lun_from_tpg(struct se_lun *lun, struct se_portal_group *tpg)struct se_dev_entry *deve;u32 i; -spin_lock_bh (&tpg->acl_node_lock); +spin_lock_irq (&tpg->acl_node_lock);list_for_each_entry (nacl, &tpg->acl_node_list, acl_list) { -spin_unlock_bh (&tpg->acl_node_lock); +spin_unlock_irq (&tpg->acl_node_lock);spin_lock_irq (&nacl->device_list_lock);for (i =0 ; i <TRANSPORT_MAX_LUNS_PER_TPG ; i++) {
@@ -491,9 +491,9 @@ void core_clear_lun_from_tpg(struct se_lun *lun, struct se_portal_group *tpg) }spin_unlock_irq (&nacl->device_list_lock); -spin_lock_bh (&tpg->acl_node_lock); +spin_lock_irq (&tpg->acl_node_lock); } -spin_unlock_bh (&tpg->acl_node_lock); +spin_unlock_irq (&tpg->acl_node_lock); }static struct se_port *core_alloc_port (struct se_device *dev)
@@ -1372,15 +1372,15 @@ struct se_lun *core_dev_add_lun(*/ if (tpg->se_tpg_tfo->tpg_check_demo_mode (tpg)) {struct se_node_acl *acl; -spin_lock_bh (&tpg->acl_node_lock); +spin_lock_irq (&tpg->acl_node_lock);list_for_each_entry (acl, &tpg->acl_node_list, acl_list) {if (acl->dynamic_node_acl) { -spin_unlock_bh (&tpg->acl_node_lock); +spin_unlock_irq (&tpg->acl_node_lock);core_tpg_add_node_to_devs (acl, tpg); -spin_lock_bh (&tpg->acl_node_lock); +spin_lock_irq (&tpg->acl_node_lock); } } -spin_unlock_bh (&tpg->acl_node_lock); +spin_unlock_irq (&tpg->acl_node_lock); }return lun_p;
drivers/target/target_core_pr.c +4 -4
@@ -1598,14 +1598,14 @@ static int core_scsi3_decode_spec_i_port(* from the decoded fabric module specific TransportID * at *i_str. */ -spin_lock_bh (&tmp_tpg->acl_node_lock); +spin_lock_irq (&tmp_tpg->acl_node_lock); dest_node_acl =__core_tpg_get_initiator_node_acl ( tmp_tpg, i_str);if (dest_node_acl) {atomic_inc (&dest_node_acl->acl_pr_ref_count);smp_mb__after_atomic_inc (); } -spin_unlock_bh (&tmp_tpg->acl_node_lock); +spin_unlock_irq (&tmp_tpg->acl_node_lock);if (!dest_node_acl) {core_scsi3_tpg_undepend_item (tmp_tpg);
@@ -3496,14 +3496,14 @@ after_iport_check:/* * Locate the destination struct se_node_acl from the received Transport ID */ -spin_lock_bh (&dest_se_tpg->acl_node_lock); +spin_lock_irq (&dest_se_tpg->acl_node_lock); dest_node_acl =__core_tpg_get_initiator_node_acl (dest_se_tpg, initiator_str);if (dest_node_acl) {atomic_inc (&dest_node_acl->acl_pr_ref_count);smp_mb__after_atomic_inc (); } -spin_unlock_bh (&dest_se_tpg->acl_node_lock); +spin_unlock_irq (&dest_se_tpg->acl_node_lock);if (!dest_node_acl) { pr_err("Unable to locate %s dest_node_acl for"
drivers/target/target_core_tpg.c +26 -26
170 lines not on this page · raw message
drivers/target/tcm_fc/tfc_conf.c +2 -2
@@ -256,7 +256,7 @@ struct ft_node_acl *ft_acl_get(struct ft_tpg *tpg, struct fc_rport_priv *rdata)struct se_portal_group *se_tpg = &tpg->se_tpg;struct se_node_acl *se_acl; -spin_lock_bh (&se_tpg->acl_node_lock); +spin_lock_irq (&se_tpg->acl_node_lock);list_for_each_entry (se_acl, &se_tpg->acl_node_list, acl_list) { acl = container_of(se_acl, struct ft_node_acl, se_node_acl); pr_debug("acl %p port_name %llx\n",
@@ -270,7 +270,7 @@ struct ft_node_acl *ft_acl_get(struct ft_tpg *tpg, struct fc_rport_priv *rdata)break ; } } -spin_unlock_bh (&se_tpg->acl_node_lock); +spin_unlock_irq (&se_tpg->acl_node_lock);return found; }
Signature · 1 line
1.7.6