Commit 15ae1375 authored by Bob Pearson's avatar Bob Pearson Committed by Jason Gunthorpe

RDMA/rxe: Fix qp reference counting for atomic ops

Currently the rdma_rxe driver attempts to protect atomic responder
resources by taking a reference to the qp which is only freed when the
resource is recycled for a new read or atomic operation. This means that
in normal circumstances there is almost always an extra qp reference once
an atomic operation has been executed which prevents cleaning up the qp
and associated pd and cqs when the qp is destroyed.

This patch removes the call to rxe_add_ref() in send_atomic_ack() and the
call to rxe_drop_ref() in free_rd_atomic_resource(). If the qp is
destroyed while a peer is retrying an atomic op it will cause the
operation to fail which is acceptable.

Link: https://lore.kernel.org/r/20210604230558.4812-1-rpearsonhpe@gmail.comReported-by: default avatarZhu Yanjun <zyjzyj2000@gmail.com>
Fixes: 86af6176 ("IB/rxe: remove unnecessary skb_clone")
Signed-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 61b460d1
...@@ -136,7 +136,6 @@ static void free_rd_atomic_resources(struct rxe_qp *qp) ...@@ -136,7 +136,6 @@ static void free_rd_atomic_resources(struct rxe_qp *qp)
void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res) void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res)
{ {
if (res->type == RXE_ATOMIC_MASK) { if (res->type == RXE_ATOMIC_MASK) {
rxe_drop_ref(qp);
kfree_skb(res->atomic.skb); kfree_skb(res->atomic.skb);
} else if (res->type == RXE_READ_MASK) { } else if (res->type == RXE_READ_MASK) {
if (res->read.mr) if (res->read.mr)
......
...@@ -989,8 +989,6 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, ...@@ -989,8 +989,6 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
goto out; goto out;
} }
rxe_add_ref(qp);
res = &qp->resp.resources[qp->resp.res_head]; res = &qp->resp.resources[qp->resp.res_head];
free_rd_atomic_resource(qp, res); free_rd_atomic_resource(qp, res);
rxe_advance_resp_resource(qp); rxe_advance_resp_resource(qp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment