diff options
author | Bob Pearson <rpearsonhpe@gmail.com> | 2022-04-20 20:40:38 -0500 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2022-05-09 09:03:45 -0300 |
commit | cf40367961d8e8af084f4333e6554205c62c7946 (patch) | |
tree | 73b15e0e37d902e74e6f55863c901dd3e1cb65a6 /drivers/infiniband | |
parent | ed2b5dd0f895f80c30e28de63ce607c2f139318e (diff) | |
download | linux-cf40367961d8e8af084f4333e6554205c62c7946.tar.bz2 |
RDMA/rxe: Move mr cleanup code to rxe_mr_cleanup()
Move the code which tears down an mr to rxe_mr_cleanup to allow operations
holding a reference to the mr to complete.
Link: https://lore.kernel.org/r/20220421014042.26985-6-rpearsonhpe@gmail.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_mr.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c index 60a31b718774..fc3942e04a1f 100644 --- a/drivers/infiniband/sw/rxe/rxe_mr.c +++ b/drivers/infiniband/sw/rxe/rxe_mr.c @@ -683,14 +683,10 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) { struct rxe_mr *mr = to_rmr(ibmr); - if (atomic_read(&mr->num_mw) > 0) { - pr_warn("%s: Attempt to deregister an MR while bound to MWs\n", - __func__); + /* See IBA 10.6.7.2.6 */ + if (atomic_read(&mr->num_mw) > 0) return -EINVAL; - } - mr->state = RXE_MR_STATE_INVALID; - rxe_put(mr_pd(mr)); rxe_put(mr); return 0; @@ -700,6 +696,8 @@ void rxe_mr_cleanup(struct rxe_pool_elem *elem) { struct rxe_mr *mr = container_of(elem, typeof(*mr), elem); + rxe_put(mr_pd(mr)); + ib_umem_release(mr->umem); if (mr->cur_map_set) |