Skip to content

Commit

Permalink
DLPX-72065 Aborted iSCSI command never completes after LUN reset (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzakha authored and Prakash Surya committed Mar 14, 2023
1 parent ae3e534 commit 26eae8a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
23 changes: 19 additions & 4 deletions drivers/target/iscsi/iscsi_target_erl1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions include/target/target_core_fabric.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 26eae8a

Please sign in to comment.