linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org
Cc: Bob Pearson <rpearsonhpe@gmail.com>
Subject: [PATCH for-next v14 05/10] RDMA/rxe: Move mr cleanup code to rxe_mr_cleanup()
Date: Wed, 20 Apr 2022 20:40:38 -0500	[thread overview]
Message-ID: <20220421014042.26985-6-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20220421014042.26985-1-rpearsonhpe@gmail.com>

Move the code which tears down an mr to rxe_mr_cleanup to allow
operations holding a reference to the mr to complete.

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_mr.c | 10 ++++------
 1 file 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)
-- 
2.32.0


  parent reply	other threads:[~2022-04-21  1:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  1:40 [PATCH for-next v14 00/10] Fix race conditions in rxe_pool Bob Pearson
2022-04-21  1:40 ` [PATCH for-next v14 01/10] RDMA/rxe: Remove IB_SRQ_INIT_MASK Bob Pearson
2022-04-21  1:40 ` [PATCH for-next v14 02/10] RDMA/rxe: Add rxe_srq_cleanup() Bob Pearson
2022-05-09 12:02   ` Jason Gunthorpe
2022-04-21  1:40 ` [PATCH for-next v14 03/10] RDMA/rxe: Check rxe_get() return value Bob Pearson
2022-04-21  1:40 ` [PATCH for-next v14 04/10] RDMA/rxe: Move qp cleanup code to rxe_qp_do_cleanup() Bob Pearson
2022-04-21  1:40 ` Bob Pearson [this message]
2022-04-21  1:40 ` [PATCH for-next v14 06/10] RDMA/rxe: Move mw cleanup code to rxe_mw_cleanup() Bob Pearson
2022-05-09 12:08   ` Jason Gunthorpe
2022-04-21  1:40 ` [PATCH for-next v14 07/10] RDMA/rxe: Enforce IBA C11-17 Bob Pearson
2022-04-21  1:40 ` [PATCH for-next v14 08/10] RDMA/rxe: Stop lookup of partially built objects Bob Pearson
2022-05-09 12:21   ` Jason Gunthorpe
2022-04-21  1:40 ` [PATCH for-next v14 09/10] RDMA/rxe: Convert read side locking to rcu Bob Pearson
2022-05-09 11:58   ` Jason Gunthorpe
2022-04-21  1:40 ` [PATCH for-next v14 10/10] RDMA/rxe: Cleanup rxe_pool.c Bob Pearson
2022-05-09 12:17   ` Jason Gunthorpe
2022-05-09 18:23 ` [PATCH for-next v14 00/10] Fix race conditions in rxe_pool Jason Gunthorpe
2022-05-10  0:35   ` Yanjun Zhu
2022-05-10 12:43     ` Jason Gunthorpe
2022-05-24  3:53   ` yangx.jy
2022-05-24 11:57     ` Jason Gunthorpe
2022-05-24 18:22       ` Bob Pearson
2022-05-24 18:26         ` Jason Gunthorpe
2022-05-24 18:27           ` Bob Pearson
2022-05-24 18:41             ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220421014042.26985-6-rpearsonhpe@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).