Commit b3e5fe16 authored by Nicholas Bellinger's avatar Nicholas Bellinger

tcm_fc: Generate TASK_SET_FULL status for DataIN failures

This patch changes ft_queue_data_in() to set SAM_STAT_TASK_SET_FULL
status upon a lport->tt.seq_send() failure, where it will now stop
sending subsequent DataIN, and immediately attempt to send the
response with exception status.

Sending a response with SAM_STAT_TASK_SET_FULL status is useful in
order to signal the initiator that it should try to reduce it's
current queue_depth, to lower the number of outstanding I/Os on
the wire.

Also, add a check to skip sending DataIN if TASK_SET_FULL status
has already been set due to a response lport->tt.seq_send()
failure, that has asked target-core to requeue a response.
Reported-by: default avatarVasu Dev <vasu.dev@linux.intel.com>
Reviewed-by: default avatarVasu Dev <vasu.dev@linux.intel.com>
Cc: Jun Wu <jwu@stormojo.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 1d2b60a5
...@@ -82,6 +82,10 @@ int ft_queue_data_in(struct se_cmd *se_cmd) ...@@ -82,6 +82,10 @@ int ft_queue_data_in(struct se_cmd *se_cmd)
if (cmd->aborted) if (cmd->aborted)
return 0; return 0;
if (se_cmd->scsi_status == SAM_STAT_TASK_SET_FULL)
goto queue_status;
ep = fc_seq_exch(cmd->seq); ep = fc_seq_exch(cmd->seq);
lport = ep->lp; lport = ep->lp;
cmd->seq = lport->tt.seq_start_next(cmd->seq); cmd->seq = lport->tt.seq_start_next(cmd->seq);
...@@ -178,14 +182,23 @@ int ft_queue_data_in(struct se_cmd *se_cmd) ...@@ -178,14 +182,23 @@ int ft_queue_data_in(struct se_cmd *se_cmd)
FC_TYPE_FCP, f_ctl, fh_off); FC_TYPE_FCP, f_ctl, fh_off);
error = lport->tt.seq_send(lport, seq, fp); error = lport->tt.seq_send(lport, seq, fp);
if (error) { if (error) {
/* XXX For now, initiator will retry */ pr_info_ratelimited("%s: Failed to send frame %p, "
pr_err_ratelimited("%s: Failed to send frame %p, "
"xid <0x%x>, remaining %zu, " "xid <0x%x>, remaining %zu, "
"lso_max <0x%x>\n", "lso_max <0x%x>\n",
__func__, fp, ep->xid, __func__, fp, ep->xid,
remaining, lport->lso_max); remaining, lport->lso_max);
/*
* Go ahead and set TASK_SET_FULL status ignoring the
* rest of the DataIN, and immediately attempt to
* send the response via ft_queue_status() in order
* to notify the initiator that it should reduce it's
* per LUN queue_depth.
*/
se_cmd->scsi_status = SAM_STAT_TASK_SET_FULL;
break;
} }
} }
queue_status:
return ft_queue_status(se_cmd); return ft_queue_status(se_cmd);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment