Skip to content

Commit cf40367

Browse files
rpearsonhpe-designjgunthorpe
authored andcommitted
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>
1 parent ed2b5dd commit cf40367

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

drivers/infiniband/sw/rxe/rxe_mr.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -683,14 +683,10 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
683683
{
684684
struct rxe_mr *mr = to_rmr(ibmr);
685685

686-
if (atomic_read(&mr->num_mw) > 0) {
687-
pr_warn("%s: Attempt to deregister an MR while bound to MWs\n",
688-
__func__);
686+
/* See IBA 10.6.7.2.6 */
687+
if (atomic_read(&mr->num_mw) > 0)
689688
return -EINVAL;
690-
}
691689

692-
mr->state = RXE_MR_STATE_INVALID;
693-
rxe_put(mr_pd(mr));
694690
rxe_put(mr);
695691

696692
return 0;
@@ -700,6 +696,8 @@ void rxe_mr_cleanup(struct rxe_pool_elem *elem)
700696
{
701697
struct rxe_mr *mr = container_of(elem, typeof(*mr), elem);
702698

699+
rxe_put(mr_pd(mr));
700+
703701
ib_umem_release(mr->umem);
704702

705703
if (mr->cur_map_set)

0 commit comments

Comments
 (0)