Skip to content

Commit 75dbf2d

Browse files
Bryant G. LyNicholas Bellinger
authored andcommitted
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 25e7853 ("ibmvscsis: Do not send aborted task response") commit 98883f1 ("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>
1 parent 98883f1 commit 75dbf2d

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

‎drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,25 @@ static void ibmvscsis_send_messages(struct scsi_info *vscsi)
17911791
list_del(&cmd->list);
17921792
ibmvscsis_free_cmd_resources(vscsi,
17931793
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;
17941813
} else {
17951814
iue = cmd->iue;
17961815

@@ -2965,10 +2984,7 @@ static long srp_build_response(struct scsi_info *vscsi,
29652984

29662985
rsp->opcode = SRP_RSP;
29672986

2968-
if (vscsi->credit > 0 && vscsi->state == SRP_PROCESSING)
2969-
rsp->req_lim_delta = cpu_to_be32(vscsi->credit);
2970-
else
2971-
rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit);
2987+
rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit);
29722988
rsp->tag = cmd->rsp.tag;
29732989
rsp->flags = 0;
29742990

0 commit comments

Comments
 (0)