aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryant G. Ly <bryantly@linux.vnet.ibm.com>2017-05-10 15:35:47 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2017-05-15 23:20:03 -0400
commit75dbf2d36f6b122ad3c1070fe4bf95f71bbff321 (patch)
tree9e135b4387de6e238458b088d9313c4dae5a7d91
parent98883f1b5415ea9dce60d5178877d15f4faa10b8 (diff)
ibmvscsis: Fix the incorrect req_lim_delta
The current code is not correctly calculating the req_lim_delta. We want to make sure vscsi->credit is always incremented when we do not send a response for the scsi op. Thus for the case where there is a successfully aborted task we need to make sure the vscsi->credit is incremented. v2 - Moves the original location of the vscsi->credit increment to a better spot. Since if we increment credit, the next command we send back will have increased req_lim_delta. But we probably shouldn't be doing that until the aborted cmd is actually released. Otherwise the client will think that it can send a new command, and we could find ourselves short of command elements. Not likely, but could happen. This patch depends on both: commit 25e78531268e ("ibmvscsis: Do not send aborted task response") commit 98883f1b5415 ("ibmvscsis: Clear left-over abort_cmd pointers") Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Reviewed-by: Michael Cyr <mikecyr@linux.vnet.ibm.com> Cc: <stable@vger.kernel.org> # v4.8+ Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index ee64241865e6..abf6026645dd 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -1791,6 +1791,25 @@ static void ibmvscsis_send_messages(struct scsi_info *vscsi)
1791 list_del(&cmd->list); 1791 list_del(&cmd->list);
1792 ibmvscsis_free_cmd_resources(vscsi, 1792 ibmvscsis_free_cmd_resources(vscsi,
1793 cmd); 1793 cmd);
1794 /*
1795 * With a successfully aborted op
1796 * through LIO we want to increment the
1797 * the vscsi credit so that when we dont
1798 * send a rsp to the original scsi abort
1799 * op (h_send_crq), but the tm rsp to
1800 * the abort is sent, the credit is
1801 * correctly sent with the abort tm rsp.
1802 * We would need 1 for the abort tm rsp
1803 * and 1 credit for the aborted scsi op.
1804 * Thus we need to increment here.
1805 * Also we want to increment the credit
1806 * here because we want to make sure
1807 * cmd is actually released first
1808 * otherwise the client will think it
1809 * it can send a new cmd, and we could
1810 * find ourselves short of cmd elements.
1811 */
1812 vscsi->credit += 1;
1794 } else { 1813 } else {
1795 iue = cmd->iue; 1814 iue = cmd->iue;
1796 1815
@@ -2965,10 +2984,7 @@ static long srp_build_response(struct scsi_info *vscsi,
2965 2984
2966 rsp->opcode = SRP_RSP; 2985 rsp->opcode = SRP_RSP;
2967 2986
2968 if (vscsi->credit > 0 && vscsi->state == SRP_PROCESSING) 2987 rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit);
2969 rsp->req_lim_delta = cpu_to_be32(vscsi->credit);
2970 else
2971 rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit);
2972 rsp->tag = cmd->rsp.tag; 2988 rsp->tag = cmd->rsp.tag;
2973 rsp->flags = 0; 2989 rsp->flags = 0;
2974 2990