WSL2-Linux-Kernel/net/sunrpc
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
..
auth_gss
xprtrdma SUNRPC: Fix NFSD's request deferral on RDMA transports 2022-04-20 09:34:18 +02:00
Kconfig
Makefile
addr.c
auth.c
auth_null.c
auth_unix.c
backchannel_rqst.c
cache.c
clnt.c SUNRPC: Handle low memory situations in call_status() 2022-04-13 20:59:20 +02:00
debugfs.c
fail.h
netns.h
rpc_pipe.c
rpcb_clnt.c
sched.c SUNRPC: remove scheduling boost for "SWAPPER" tasks. 2022-04-13 20:59:12 +02:00
socklib.c
socklib.h
stats.c
sunrpc.h
sunrpc_syms.c
svc.c NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment() 2022-03-08 19:12:33 +01:00
svc_xprt.c SUNRPC: Fix NFSD's request deferral on RDMA transports 2022-04-20 09:34:18 +02:00
svcauth.c
svcauth_unix.c
svcsock.c SUNRPC: svc_tcp_sendmsg() should handle errors from xdr_alloc_bvec() 2022-04-13 20:59:20 +02:00
sysctl.c
sysfs.c sunrpc: Fix potential race conditions in rpc_sysfs_xprt_state_change() 2022-02-16 12:56:10 +01:00
sysfs.h
timer.c
xdr.c
xprt.c SUNRPC: Prevent immediate close+reconnect 2022-04-13 20:59:24 +02:00
xprtmultipath.c
xprtsock.c SUNRPC: Don't call connect() more than once on a TCP socket 2022-04-13 20:59:26 +02:00