linux/net/sunrpc/xprtrdma
Chuck Lever 4cf44be6f1 xprtrdma: Fix recursion into rpcrdma_xprt_disconnect()
Both Dan and I have observed two processes invoking
rpcrdma_xprt_disconnect() concurrently. In my case:

1. The connect worker invokes rpcrdma_xprt_disconnect(), which
   drains the QP and waits for the final completion
2. This causes the newly posted Receive to flush and invoke
   xprt_force_disconnect()
3. xprt_force_disconnect() sets CLOSE_WAIT and wakes up the RPC task
   that is holding the transport lock
4. The RPC task invokes xprt_connect(), which calls ->ops->close
5. xprt_rdma_close() invokes rpcrdma_xprt_disconnect(), which tries
   to destroy the QP.

Deadlock.

To prevent xprt_force_disconnect() from waking anything, handle the
clean up after a failed connection attempt in the xprt's sndtask.

The retry loop is removed from rpcrdma_xprt_connect() to ensure
that the newly allocated ep and id are properly released before
a REJECTED connection attempt can be retried.

Reported-by: Dan Aloni <dan@kernelim.com>
Fixes: e28ce90083 ("xprtrdma: kmalloc rpcrdma_ep separate from rpcrdma_xprt")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2020-07-13 10:50:41 -04:00
..
backchannel.c xprtrdma: kmalloc rpcrdma_ep separate from rpcrdma_xprt 2020-03-27 10:47:25 -04:00
frwr_ops.c xprtrdma: Clean up synopsis of rpcrdma_flush_disconnect() 2020-06-22 09:34:35 -04:00
Makefile xprtrdma: Remove support for FMR memory registration 2019-01-02 12:05:17 -05:00
module.c NFS client updates for Linux 4.18 2018-06-12 10:09:03 -07:00
rpc_rdma.c xprtrdma: Fix handling of RDMA_ERROR replies 2020-06-22 09:34:35 -04:00
svc_rdma_backchannel.c svcrdma: Remove backchannel dprintk call sites 2020-05-18 10:21:21 -04:00
svc_rdma_recvfrom.c svcrdma: Rename tracepoints that record header decoding errors 2020-05-18 10:21:21 -04:00
svc_rdma_rw.c svcrdma: trace undersized Write chunks 2020-05-18 10:21:21 -04:00
svc_rdma_sendto.c SUNRPC: Move xpt_mutex into socket xpo_sendto methods 2020-05-18 10:21:21 -04:00
svc_rdma_transport.c SUNRPC: Trace a few more generic svc_xprt events 2020-05-18 10:21:22 -04:00
svc_rdma.c sysctl: pass kernel pointers to ->proc_handler 2020-04-27 02:07:40 -04:00
transport.c xprtrdma: Fix recursion into rpcrdma_xprt_disconnect() 2020-07-13 10:50:41 -04:00
verbs.c xprtrdma: Fix recursion into rpcrdma_xprt_disconnect() 2020-07-13 10:50:41 -04:00
xprt_rdma.h xprtrdma: Clean up disconnect 2020-06-22 09:34:35 -04:00