[2/2] xprtrdma: Fix completion wait during device removal
diff mbox series

Message ID 20191202162844.4115.30993.stgit@manet.1015granger.net
State New
Headers show
Series
  • xprtrdma device removal bug fixes
Related show

Commit Message

Chuck Lever Dec. 2, 2019, 4:28 p.m. UTC
I've found that on occasion, "rmmod <dev>" will hang while if an NFS
is under load.

Ensure that ri_remove_done is initialized only just before the
transport is woken up to force a close. This avoids the completion
possibly getting initialized again while the CM event handler is
waiting for a wake-up.

Fixes: bebd031866ca ("xprtrdma: Support unplugging an HCA from under an NFS mount")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/xprtrdma/verbs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chuck Lever Dec. 2, 2019, 4:40 p.m. UTC | #1
> On Dec 2, 2019, at 11:28 AM, Chuck Lever <chuck.lever@oracle.com> wrote:
> 
> I've found that on occasion, "rmmod <dev>" will hang while if an NFS
> is under load.

ETOOMUCHTURKEY. How about:

I've found that on occasion, "rmmod <dev>" hangs while an NFS mount
is under load.


> Ensure that ri_remove_done is initialized only just before the
> transport is woken up to force a close. This avoids the completion
> possibly getting initialized again while the CM event handler is
> waiting for a wake-up.
> 
> Fixes: bebd031866ca ("xprtrdma: Support unplugging an HCA from under an NFS mount")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> net/sunrpc/xprtrdma/verbs.c |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
> index 3a56458e8c05..2c40465a19e1 100644
> --- a/net/sunrpc/xprtrdma/verbs.c
> +++ b/net/sunrpc/xprtrdma/verbs.c
> @@ -244,6 +244,7 @@ static void rpcrdma_update_cm_private(struct rpcrdma_xprt *r_xprt,
> 			ia->ri_id->device->name,
> 			rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt));
> #endif
> +		init_completion(&ia->ri_remove_done);
> 		set_bit(RPCRDMA_IAF_REMOVING, &ia->ri_flags);
> 		ep->rep_connected = -ENODEV;
> 		xprt_force_disconnect(xprt);
> @@ -297,7 +298,6 @@ static void rpcrdma_update_cm_private(struct rpcrdma_xprt *r_xprt,
> 	int rc;
> 
> 	init_completion(&ia->ri_done);
> -	init_completion(&ia->ri_remove_done);
> 
> 	id = rdma_create_id(xprt->rx_xprt.xprt_net, rpcrdma_cm_event_handler,
> 			    xprt, RDMA_PS_TCP, IB_QPT_RC);
> 

--
Chuck Lever

Patch
diff mbox series

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 3a56458e8c05..2c40465a19e1 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -244,6 +244,7 @@  static void rpcrdma_update_cm_private(struct rpcrdma_xprt *r_xprt,
 			ia->ri_id->device->name,
 			rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt));
 #endif
+		init_completion(&ia->ri_remove_done);
 		set_bit(RPCRDMA_IAF_REMOVING, &ia->ri_flags);
 		ep->rep_connected = -ENODEV;
 		xprt_force_disconnect(xprt);
@@ -297,7 +298,6 @@  static void rpcrdma_update_cm_private(struct rpcrdma_xprt *r_xprt,
 	int rc;
 
 	init_completion(&ia->ri_done);
-	init_completion(&ia->ri_remove_done);
 
 	id = rdma_create_id(xprt->rx_xprt.xprt_net, rpcrdma_cm_event_handler,
 			    xprt, RDMA_PS_TCP, IB_QPT_RC);