diff options
| -rw-r--r-- | drivers/target/tcm_fc/tfc_cmd.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index f5fd515b2bee..be0c0d08c56a 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
| @@ -128,6 +128,7 @@ int ft_queue_status(struct se_cmd *se_cmd) | |||
| 128 | struct fc_lport *lport; | 128 | struct fc_lport *lport; |
| 129 | struct fc_exch *ep; | 129 | struct fc_exch *ep; |
| 130 | size_t len; | 130 | size_t len; |
| 131 | int rc; | ||
| 131 | 132 | ||
| 132 | if (cmd->aborted) | 133 | if (cmd->aborted) |
| 133 | return 0; | 134 | return 0; |
| @@ -137,9 +138,10 @@ int ft_queue_status(struct se_cmd *se_cmd) | |||
| 137 | len = sizeof(*fcp) + se_cmd->scsi_sense_length; | 138 | len = sizeof(*fcp) + se_cmd->scsi_sense_length; |
| 138 | fp = fc_frame_alloc(lport, len); | 139 | fp = fc_frame_alloc(lport, len); |
| 139 | if (!fp) { | 140 | if (!fp) { |
| 140 | /* XXX shouldn't just drop it - requeue and retry? */ | 141 | se_cmd->scsi_status = SAM_STAT_TASK_SET_FULL; |
| 141 | return 0; | 142 | return -ENOMEM; |
| 142 | } | 143 | } |
| 144 | |||
| 143 | fcp = fc_frame_payload_get(fp, len); | 145 | fcp = fc_frame_payload_get(fp, len); |
| 144 | memset(fcp, 0, len); | 146 | memset(fcp, 0, len); |
| 145 | fcp->resp.fr_status = se_cmd->scsi_status; | 147 | fcp->resp.fr_status = se_cmd->scsi_status; |
| @@ -170,7 +172,18 @@ int ft_queue_status(struct se_cmd *se_cmd) | |||
| 170 | fc_fill_fc_hdr(fp, FC_RCTL_DD_CMD_STATUS, ep->did, ep->sid, FC_TYPE_FCP, | 172 | fc_fill_fc_hdr(fp, FC_RCTL_DD_CMD_STATUS, ep->did, ep->sid, FC_TYPE_FCP, |
| 171 | FC_FC_EX_CTX | FC_FC_LAST_SEQ | FC_FC_END_SEQ, 0); | 173 | FC_FC_EX_CTX | FC_FC_LAST_SEQ | FC_FC_END_SEQ, 0); |
| 172 | 174 | ||
| 173 | lport->tt.seq_send(lport, cmd->seq, fp); | 175 | rc = lport->tt.seq_send(lport, cmd->seq, fp); |
| 176 | if (rc) { | ||
| 177 | pr_info_ratelimited("%s: Failed to send response frame %p, " | ||
| 178 | "xid <0x%x>\n", __func__, fp, ep->xid); | ||
| 179 | /* | ||
| 180 | * Generate a TASK_SET_FULL status to notify the initiator | ||
| 181 | * to reduce it's queue_depth after the se_cmd response has | ||
| 182 | * been re-queued by target-core. | ||
| 183 | */ | ||
| 184 | se_cmd->scsi_status = SAM_STAT_TASK_SET_FULL; | ||
| 185 | return -ENOMEM; | ||
| 186 | } | ||
| 174 | lport->tt.exch_done(cmd->seq); | 187 | lport->tt.exch_done(cmd->seq); |
| 175 | return 0; | 188 | return 0; |
| 176 | } | 189 | } |
