[PATCH v1] ibmvscsis: Fix the incorrect req_lim_delta

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Bryant G. Ly <bryantly@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Michael Cyr <mikecyr@xxxxxxxxxxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # v4.8+
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index ee64241..2d97f02 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -2965,10 +2965,7 @@ static long srp_build_response(struct scsi_info *vscsi,
 
 	rsp->opcode = SRP_RSP;
 
-	if (vscsi->credit > 0 && vscsi->state == SRP_PROCESSING)
-		rsp->req_lim_delta = cpu_to_be32(vscsi->credit);
-	else
-		rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit);
+	rsp->req_lim_delta = cpu_to_be32(1 + vscsi->credit);
 	rsp->tag = cmd->rsp.tag;
 	rsp->flags = 0;
 
@@ -3739,6 +3736,22 @@ static void ibmvscsis_queue_tm_rsp(struct se_cmd *se_cmd)
 
 static void ibmvscsis_aborted_task(struct se_cmd *se_cmd)
 {
+	struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd,
+						 se_cmd);
+	struct scsi_info *vscsi = cmd->adapter;
+
+	/*
+	 * With a successfully aborted op through LIO we want to increment the
+	 * the vscsi credit so that when we dont send a rsp to the original
+	 * scsi abort op but the tm rsp to the abort is sent, the credit is
+	 * correctly sent with the abort tm rsp. We would need 1 for the abort
+	 * tm rsp and 1 credit for the aborted scsi op. Thus we need to
+	 * increment here.
+	 */
+	spin_lock_bh(&vscsi->intr_lock);
+	vscsi->credit += 1;
+	spin_unlock_bh(&vscsi->intr_lock);
+
 	pr_debug("ibmvscsis_aborted_task %p task_tag: %llu\n",
 		 se_cmd, se_cmd->tag);
 }
-- 
2.5.4 (Apple Git-61)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux