]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.117/scsi-rdma-srpt-fix-a-credit-leak-for-aborted-commands.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 4.14.117 / scsi-rdma-srpt-fix-a-credit-leak-for-aborted-commands.patch
CommitLineData
c0a3111a
GKH
1From 40ca8757291ca7a8775498112d320205b2a2e571 Mon Sep 17 00:00:00 2001
2From: Bart Van Assche <bvanassche@acm.org>
3Date: Fri, 25 Jan 2019 10:34:51 -0800
4Subject: scsi: RDMA/srpt: Fix a credit leak for aborted commands
5
6From: Bart Van Assche <bvanassche@acm.org>
7
8commit 40ca8757291ca7a8775498112d320205b2a2e571 upstream.
9
10Make sure that the next time a response is sent to the initiator that the
11credit it had allocated for the aborted request gets freed.
12
13Cc: Doug Ledford <dledford@redhat.com>
14Cc: Jason Gunthorpe <jgg@ziepe.ca>
15Cc: Nicholas Bellinger <nab@linux-iscsi.org>
16Cc: Mike Christie <mchristi@redhat.com>
17Cc: Hannes Reinecke <hare@suse.com>
18Cc: Christoph Hellwig <hch@lst.de>
19Fixes: 131e6abc674e ("target: Add TFO->abort_task for aborted task resources release") # v3.15
20Signed-off-by: Bart Van Assche <bvanassche@acm.org>
21Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
22Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24---
25 drivers/infiniband/ulp/srpt/ib_srpt.c | 11 +++++++++++
26 1 file changed, 11 insertions(+)
27
28--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
29+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
30@@ -2381,8 +2381,19 @@ static void srpt_queue_tm_rsp(struct se_
31 srpt_queue_response(cmd);
32 }
33
34+/*
35+ * This function is called for aborted commands if no response is sent to the
36+ * initiator. Make sure that the credits freed by aborting a command are
37+ * returned to the initiator the next time a response is sent by incrementing
38+ * ch->req_lim_delta.
39+ */
40 static void srpt_aborted_task(struct se_cmd *cmd)
41 {
42+ struct srpt_send_ioctx *ioctx = container_of(cmd,
43+ struct srpt_send_ioctx, cmd);
44+ struct srpt_rdma_ch *ch = ioctx->ch;
45+
46+ atomic_inc(&ch->req_lim_delta);
47 }
48
49 static int srpt_queue_status(struct se_cmd *cmd)