Skip to content

Commit bab9f8d

Browse files
jinpuwangrleon
authored andcommitted
RDMA/rtrs-clt: Do local invalidate after write io completion
Switch local invalidate after write io completion avoid the chain usage of WR, this fixed the local protection error on LOCAL INVALIDATE WR. Signed-off-by: Jack Wang <[email protected]> Signed-off-by: Md Haris Iqbal <[email protected]> Signed-off-by: Grzegorz Prajsner <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 667db86 commit bab9f8d

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

drivers/infiniband/ulp/rtrs/rtrs-clt.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -395,16 +395,19 @@ static void complete_rdma_req(struct rtrs_clt_io_req *req, int errno,
395395
/*
396396
* We are here to invalidate read/write requests
397397
* ourselves. In normal scenario server should
398-
* send INV for all read requests, we do chained local
399-
* invalidate for write requests, but
400-
* we are here, thus two things could happen:
398+
* send INV for all read requests, we do local
399+
* invalidate for write requests ourselves, but
400+
* we are here, thus three things could happen:
401401
*
402402
* 1. this is failover, when errno != 0
403403
* and can_wait == 1,
404404
*
405405
* 2. something totally bad happened and
406406
* server forgot to send INV, so we
407407
* should do that ourselves.
408+
*
409+
* 3. write request finishes, we need to do local
410+
* invalidate
408411
*/
409412

410413
if (can_wait) {
@@ -1085,7 +1088,6 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req *req)
10851088
int ret, count = 0;
10861089
u32 imm, buf_id;
10871090
struct ib_reg_wr rwr;
1088-
struct ib_send_wr inv_wr;
10891091
struct ib_send_wr *wr = NULL;
10901092
bool fr_en = false;
10911093

@@ -1126,13 +1128,6 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req *req)
11261128
req->sg_cnt, req->dir);
11271129
return ret;
11281130
}
1129-
inv_wr = (struct ib_send_wr) {
1130-
.opcode = IB_WR_LOCAL_INV,
1131-
.wr_cqe = &req->inv_cqe,
1132-
.send_flags = IB_SEND_SIGNALED,
1133-
.ex.invalidate_rkey = req->mr->rkey,
1134-
};
1135-
req->inv_cqe.done = rtrs_clt_inv_rkey_done;
11361131
rwr = (struct ib_reg_wr) {
11371132
.wr.opcode = IB_WR_REG_MR,
11381133
.wr.wr_cqe = &fast_reg_cqe,
@@ -1142,7 +1137,6 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req *req)
11421137
};
11431138
wr = &rwr.wr;
11441139
fr_en = true;
1145-
refcount_inc(&req->ref);
11461140
req->mr->need_inval = true;
11471141
}
11481142
/*
@@ -1153,7 +1147,7 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req *req)
11531147

11541148
ret = rtrs_post_rdma_write_sg(req->con, req, rbuf, fr_en, count,
11551149
req->usr_len + sizeof(*msg),
1156-
imm, wr, &inv_wr);
1150+
imm, wr, NULL);
11571151
if (ret) {
11581152
rtrs_err_rl(s,
11591153
"Write request failed: error=%d path=%s [%s:%u]\n",

0 commit comments

Comments
 (0)