diff mbox series

[v1,3/8] xprtrdma: Put flushed Receives on free list instead of destroying them

Message ID 161721937732.515226.2170674299158077377.stgit@manet.1015granger.net (mailing list archive)
State New
Headers show
Series xprtrdma Receive Queue fixes | expand

Commit Message

Chuck Lever III March 31, 2021, 7:36 p.m. UTC
Defer destruction of an rpcrdma_rep until transport tear-down to
avoid races between Receive completion and rpcrdma_reps_unmap().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/xprtrdma/verbs.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tom Talpey March 31, 2021, 8:02 p.m. UTC | #1
On 3/31/2021 3:36 PM, Chuck Lever wrote:
> Defer destruction of an rpcrdma_rep until transport tear-down to
> avoid races between Receive completion and rpcrdma_reps_unmap().

This seems sketchy, but it's a good approach to destroy in one
place, and off the hot path. You might restate the description
in a positive way, not strictly to avoid a race.

Reviewed-By: Tom Talpey <tom@talpey.com>

> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>   net/sunrpc/xprtrdma/verbs.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
> index 1d88685badbe..92af272f9cc9 100644
> --- a/net/sunrpc/xprtrdma/verbs.c
> +++ b/net/sunrpc/xprtrdma/verbs.c
> @@ -80,6 +80,8 @@ static void rpcrdma_sendctx_put_locked(struct rpcrdma_xprt *r_xprt,
>   				       struct rpcrdma_sendctx *sc);
>   static int rpcrdma_reqs_setup(struct rpcrdma_xprt *r_xprt);
>   static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt);
> +static void rpcrdma_rep_put(struct rpcrdma_buffer *buf,
> +			    struct rpcrdma_rep *rep);
>   static void rpcrdma_rep_destroy(struct rpcrdma_rep *rep);
>   static void rpcrdma_reps_unmap(struct rpcrdma_xprt *r_xprt);
>   static void rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt);
> @@ -205,7 +207,7 @@ static void rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
>   
>   out_flushed:
>   	rpcrdma_flush_disconnect(r_xprt, wc);
> -	rpcrdma_rep_destroy(rep);
> +	rpcrdma_rep_put(&r_xprt->rx_buf, rep);
>   }
>   
>   static void rpcrdma_update_cm_private(struct rpcrdma_ep *ep,
> 
> 
>
diff mbox series

Patch

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 1d88685badbe..92af272f9cc9 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -80,6 +80,8 @@  static void rpcrdma_sendctx_put_locked(struct rpcrdma_xprt *r_xprt,
 				       struct rpcrdma_sendctx *sc);
 static int rpcrdma_reqs_setup(struct rpcrdma_xprt *r_xprt);
 static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt);
+static void rpcrdma_rep_put(struct rpcrdma_buffer *buf,
+			    struct rpcrdma_rep *rep);
 static void rpcrdma_rep_destroy(struct rpcrdma_rep *rep);
 static void rpcrdma_reps_unmap(struct rpcrdma_xprt *r_xprt);
 static void rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt);
@@ -205,7 +207,7 @@  static void rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
 
 out_flushed:
 	rpcrdma_flush_disconnect(r_xprt, wc);
-	rpcrdma_rep_destroy(rep);
+	rpcrdma_rep_put(&r_xprt->rx_buf, rep);
 }
 
 static void rpcrdma_update_cm_private(struct rpcrdma_ep *ep,