WSL2-Linux-Kernel/net/sunrpc/xprtrdma
Chuck Lever f5e13d700a SUNRPC: Fix NFSD's request deferral on RDMA transports
commit 773f91b2cf upstream.

Trond Myklebust reports an NFSD crash in svc_rdma_sendto(). Further
investigation shows that the crash occurred while NFSD was handling
a deferred request.

This patch addresses two inter-related issues that prevent request
deferral from working correctly for RPC/RDMA requests:

1. Prevent the crash by ensuring that the original
   svc_rqst::rq_xprt_ctxt value is available when the request is
   revisited. Otherwise svc_rdma_sendto() does not have a Receive
   context available with which to construct its reply.

2. Possibly since before commit 71641d99ce ("svcrdma: Properly
   compute .len and .buflen for received RPC Calls"),
   svc_rdma_recvfrom() did not include the transport header in the
   returned xdr_buf. There should have been no need for svc_defer()
   and friends to save and restore that header, as of that commit.
   This issue is addressed in a backport-friendly way by simply
   having svc_rdma_recvfrom() set rq_xprt_hlen to zero
   unconditionally, just as svc_tcp_recvfrom() does. This enables
   svc_deferred_recv() to correctly reconstruct an RPC message
   received via RPC/RDMA.

Reported-by: Trond Myklebust <trondmy@hammerspace.com>
Link: https://lore.kernel.org/linux-nfs/82662b7190f26fb304eb0ab1bb04279072439d4e.camel@hammerspace.com/
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-20 09:34:18 +02:00
..
Makefile svcrdma: Add a "parsed chunk list" data structure 2020-11-30 13:00:22 -05:00
backchannel.c xprtrdma: Eliminate rpcrdma_post_sends() 2021-08-09 16:42:25 -04:00
frwr_ops.c xprtrdma: Add an xprtrdma_post_send_err tracepoint 2021-08-09 16:42:18 -04:00
module.c SUNRPC: xprt_load_transport() needs to support the netid "rdma6" 2020-12-02 14:05:52 -05:00
rpc_rdma.c xprtrdma: Revert 586a0787ce 2021-05-27 08:46:19 -04:00
svc_rdma.c svcrdma: Deprecate stat variables that are no longer used 2021-01-25 09:36:28 -05:00
svc_rdma_backchannel.c svcrdma: Normalize Send page handling 2021-03-22 13:22:13 -04:00
svc_rdma_pcl.c svcrdma: Add a "parsed chunk list" data structure 2020-11-30 13:00:22 -05:00
svc_rdma_recvfrom.c SUNRPC: Fix NFSD's request deferral on RDMA transports 2022-04-20 09:34:18 +02:00
svc_rdma_rw.c svcrdma: Convert rdma->sc_rw_ctxts to llist 2021-08-17 11:47:53 -04:00
svc_rdma_sendto.c svcrdma: Relieve contention on sc_send_lock. 2021-08-17 11:47:53 -04:00
svc_rdma_transport.c svcrdma: xpt_bc_xprt is already clear in __svc_rdma_free() 2021-08-19 08:29:32 -04:00
transport.c SUNRPC/xprt: async tasks mustn't block waiting for memory 2022-04-13 20:59:12 +02:00
verbs.c xprtrdma: fix pointer derefs in error cases of rpcrdma_ep_create 2022-02-23 12:03:19 +01:00
xprt_rdma.h xprtrdma: Eliminate rpcrdma_post_sends() 2021-08-09 16:42:25 -04:00