xprtrdma device removal bug fixes
Subsystems (4)
cover xprtrdma device removal bug fixes
Hi Anna-
Here are two bug fixes related to DEVICE_REMOVAL support in the RPC/RDMA client. Can these go in 5.5-rc ?
Both of these deserve a stable tag, IMHO, as does 572c4b40a394 ("xprtrdma: Fix MR list handling") which I've already sent as part of for-5.5.
There's one remaining crasher that I hit when removing a device while there are active NFS mounts. I should have a fix for that one soon.
---
Chuck Lever (2):
xprtrdma: Fix create_qp crash on device unload
xprtrdma: Fix completion wait during device removal
net/sunrpc/xprtrdma/verbs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
--
Chuck Lever
PATCH 1/2 xprtrdma: Fix create_qp crash on device unload
On device re-insertion, the RDMA device driver crashes trying to set up a new QP:
Nov 27 16:32:06 manet kernel: BUG: kernel NULL pointer dereference, address: 00000000000001c0 Nov 27 16:32:06 manet kernel: #PF: supervisor write access in kernel mode Nov 27 16:32:06 manet kernel: #PF: error_code(0x0002) - not-present page Nov 27 16:32:06 manet kernel: PGD 0 P4D 0 Nov 27 16:32:06 manet kernel: Oops: 0002 [#1] SMP Nov 27 16:32:06 manet kernel: CPU: 1 PID: 345 Comm: kworker/u28:0 Tainted: G W 5.4.0 #852 Nov 27 16:32:06 manet kernel: Hardware name: Supermicro SYS-6028R-T/X10DRi, BIOS 1.1a 10/16/2015 Nov 27 16:32:06 manet kernel: Workqueue: xprtiod xprt_rdma_connect_worker [rpcrdma] Nov 27 16:32:06 manet kernel: RIP: 0010:atomic_try_cmpxchg+0x2/0x12 Nov 27 16:32:06 manet kernel: Code: ff ff 48 8b 04 24 5a c3 c6 07 00 0f 1f 40 00 c3 31 c0 48 81 ff 08 09 68 81 72 0c 31 c0 48 81 ff 83 0c 68 81 0f 92 c0 c3 8b 06 <f0> 0f b1 17 0f 94 c2 84 d2 75 02 89 06 88 d0 c3 53 ba 01 00 00 00 Nov 27 16:32:06 manet kernel: RSP: 0018:ffffc900035abbf0 EFLAGS: 00010046 Nov 27 16:32:06 manet kernel: RAX: 0000000000000000 RBX: 00000000000001c0 RCX: 0000000000000000 Nov 27 16:32:06 manet kernel: RDX: 0000000000000001 RSI: ffffc900035abbfc RDI: 00000000000001c0 Nov 27 16:32:06 manet kernel: RBP: ffffc900035abde0 R08: 000000000000000e R09: ffffffffffffc000 Nov 27 16:32:06 manet kernel: R10: 0000000000000000 R11: 000000000002e800 R12: ffff88886169d9f8 Nov 27 16:32:06 manet kernel: R13: ffff88886169d9f4 R14: 0000000000000246 R15: 0000000000000000 Nov 27 16:32:06 manet kernel: FS: 0000000000000000(0000) GS:ffff88846fa40000(0000) knlGS:0000000000000000 Nov 27 16:32:06 manet kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Nov 27 16:32:06 manet kernel: CR2: 00000000000001c0 CR3: 0000000002009006 CR4: 00000000001606e0 Nov 27 16:32:06 manet kernel: Call Trace: Nov 27 16:32:06 manet kernel: do_raw_spin_lock+0x2f/0x5a Nov 27 16:32:06 manet kernel: create_qp_common.isra.47+0x856/0xadf [mlx4_ib] Nov 27 16:32:06 manet kernel: ? slab_post_alloc_hook.isra.60+0xa/0x1a Nov 27 16:32:06 manet kernel: ? __kmalloc+0x125/0x139 Nov 27 16:32:06 manet kernel: mlx4_ib_create_qp+0x57f/0x972 [mlx4_ib]
The fix is to copy the qp_init_attr struct that was just created by rpcrdma_ep_create() instead of using the one from the previous connection instance.
--- net/sunrpc/xprtrdma/verbs.c | 2 ++ 1 file changed, 2 insertions(+)
net/sunrpc/xprtrdma/verbs.c +2 -0
@@ -599,6 +599,7 @@ static int rpcrdma_ep_recreate_xprt(struct rpcrdma_xprt *r_xprt, struct ib_qp_init_attr *qp_init_attr) {struct rpcrdma_ia *ia = &r_xprt->rx_ia; +struct rpcrdma_ep *ep = &r_xprt->rx_ep;int rc, err;trace_xprtrdma_reinsert (r_xprt);
@@ -613,6 +614,7 @@ static int rpcrdma_ep_recreate_xprt(struct rpcrdma_xprt *r_xprt,pr_err ("rpcrdma: rpcrdma_ep_create returned %d\n" , err); goto out2; } +memcpy (qp_init_attr, &ep->rep_attr,sizeof (*qp_init_attr)); rc = -ENETUNREACH ; err =rdma_create_qp (ia->ri_id, ia->ri_pd, qp_init_attr);
PATCH 2/2 xprtrdma: Fix completion wait during device removal
In reply to Chuck LeverI'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.
--- net/sunrpc/xprtrdma/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/xprtrdma/verbs.c +1 -1
@@ -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 );
Re: [PATCH 2/2] xprtrdma: Fix completion wait during device removal
Quoted 6 lines · Chuck Lever
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.
Quoted 25 lines
Ensure that
ri_remove_doneis 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 <[email protected]>---
net/sunrpc/xprtrdma/verbs.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)net/sunrpc/xprtrdma/verbs.c +1
-0@@ -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);
net/sunrpc/xprtrdma/verbs.c static void rpcrdma_update_cm_private(struct rpcrdma_xprt *r_xprt, · line 303
Quoted 7 lines
net/sunrpc/xprtrdma/verbs.c +0
-1@@ -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