diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index 0dd52f484fec3..10291b9bb708b 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c @@ -1102,6 +1102,18 @@ void iscsit_handle_dataout_timeout(struct timer_list *t) iscsit_inc_conn_usage_count(conn); + /* + * If the command was aborted, for instance following a LUN RESET, + * a dataout timeout might be normal. + */ + if (target_cmd_interrupted(&cmd->se_cmd)) { + pr_debug("DataOut timeout on interrupted cmd with" + " ITT[0x%08llx]\n", cmd->se_cmd.tag); + cmd->dataout_timer_flags &= ~ISCSI_TF_RUNNING; + iscsit_dec_conn_usage_count(conn); + return; + } + spin_lock_bh(&cmd->dataout_timeout_lock); if (cmd->dataout_timer_flags & ISCSI_TF_STOP) { spin_unlock_bh(&cmd->dataout_timeout_lock); @@ -1115,19 +1127,22 @@ void iscsit_handle_dataout_timeout(struct timer_list *t) if (!sess->sess_ops->ErrorRecoveryLevel) { pr_err("Unable to recover from DataOut timeout while" " in ERL=0, closing iSCSI connection for I_T Nexus" - " %s,i,0x%6phN,%s,t,0x%02x\n", + " %s,i,0x%6phN,%s,t,0x%02x, cmd ITT[0x%08llx]\n", sess->sess_ops->InitiatorName, sess->isid, - sess->tpg->tpg_tiqn->tiqn, (u32)sess->tpg->tpgt); + sess->tpg->tpg_tiqn->tiqn, (u32)sess->tpg->tpgt, + cmd->se_cmd.tag); goto failure; } if (++cmd->dataout_timeout_retries == na->dataout_timeout_retries) { pr_err("Command ITT: 0x%08x exceeded max retries" " for DataOUT timeout %u, closing iSCSI connection for" - " I_T Nexus %s,i,0x%6phN,%s,t,0x%02x\n", + " I_T Nexus %s,i,0x%6phN,%s,t,0x%02x," + " cmd ITT[0x%08llx]\n", cmd->init_task_tag, na->dataout_timeout_retries, sess->sess_ops->InitiatorName, sess->isid, - sess->tpg->tpg_tiqn->tiqn, (u32)sess->tpg->tpgt); + sess->tpg->tpg_tiqn->tiqn, (u32)sess->tpg->tpgt, + cmd->se_cmd.tag); goto failure; } diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 72edf5bd75ee6..725f3c3d79f5d 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -849,7 +849,7 @@ static void target_abort_work(struct work_struct *work) target_handle_abort(cmd); } -static bool target_cmd_interrupted(struct se_cmd *cmd) +bool target_cmd_interrupted(struct se_cmd *cmd) { int post_ret; @@ -868,6 +868,7 @@ static bool target_cmd_interrupted(struct se_cmd *cmd) return false; } +EXPORT_SYMBOL(target_cmd_interrupted); /* May be called from interrupt context so must not sleep. */ void target_complete_cmd_with_sense(struct se_cmd *cmd, u8 scsi_status, diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 3c5ade7a04a68..3aa4f48981ab5 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -176,6 +176,7 @@ sense_reason_t transport_generic_new_cmd(struct se_cmd *); void target_put_cmd_and_wait(struct se_cmd *cmd); void target_execute_cmd(struct se_cmd *cmd); +bool target_cmd_interrupted(struct se_cmd *cmd); int transport_generic_free_cmd(struct se_cmd *, int);