]>
Commit | Line | Data |
---|---|---|
c0a3111a GKH |
1 | From 40ca8757291ca7a8775498112d320205b2a2e571 Mon Sep 17 00:00:00 2001 |
2 | From: Bart Van Assche <bvanassche@acm.org> | |
3 | Date: Fri, 25 Jan 2019 10:34:51 -0800 | |
4 | Subject: scsi: RDMA/srpt: Fix a credit leak for aborted commands | |
5 | ||
6 | From: Bart Van Assche <bvanassche@acm.org> | |
7 | ||
8 | commit 40ca8757291ca7a8775498112d320205b2a2e571 upstream. | |
9 | ||
10 | Make sure that the next time a response is sent to the initiator that the | |
11 | credit it had allocated for the aborted request gets freed. | |
12 | ||
13 | Cc: Doug Ledford <dledford@redhat.com> | |
14 | Cc: Jason Gunthorpe <jgg@ziepe.ca> | |
15 | Cc: Nicholas Bellinger <nab@linux-iscsi.org> | |
16 | Cc: Mike Christie <mchristi@redhat.com> | |
17 | Cc: Hannes Reinecke <hare@suse.com> | |
18 | Cc: Christoph Hellwig <hch@lst.de> | |
19 | Fixes: 131e6abc674e ("target: Add TFO->abort_task for aborted task resources release") # v3.15 | |
20 | Signed-off-by: Bart Van Assche <bvanassche@acm.org> | |
21 | Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> | |
22 | Signed-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) |