linux-stable/net/sunrpc
Chuck Lever d41689a34a SUNRPC: Revert 241b1f419f ("SUNRPC: Remove xdr_buf_trim()")
commit 0a8e7b7d08 upstream.

I've noticed that when krb5i or krb5p security is in use,
retransmitted requests are missing the server's duplicate reply
cache. The computed checksum on the retransmitted request does not
match the cached checksum, resulting in the server performing the
retransmitted request again instead of returning the cached reply.

The assumptions made when removing xdr_buf_trim() were not correct.
In the send paths, the upper layer has already set the segment
lengths correctly, and shorting the buffer's content is simply a
matter of reducing buf->len.

xdr_buf_trim() is the right answer in the receive/unwrap path on
both the client and the server. The buffer segment lengths have to
be shortened one-by-one.

On the server side in particular, head.iov_len needs to be updated
correctly to enable nfsd_cache_csum() to work correctly. The simple
buf->len computation doesn't do that, and that results in
checksumming stale data in the buffer.

The problem isn't noticed until there's significant instability of
the RPC transport. At that point, the reliability of retransmit
detection on the server becomes crucial.

Fixes: 241b1f419f ("SUNRPC: Remove xdr_buf_trim()")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-20 08:20:39 +02:00
..
auth_gss SUNRPC: Revert 241b1f419f ("SUNRPC: Remove xdr_buf_trim()") 2020-05-20 08:20:39 +02:00
xprtrdma svcrdma: Fix leak of svc_rdma_recv_ctxt objects 2020-05-02 08:48:48 +02:00
addr.c
auth.c
auth_null.c
auth_unix.c
backchannel_rqst.c
cache.c
clnt.c SUNRPC: Signalled ASYNC tasks need to exit 2020-05-20 08:20:24 +02:00
debugfs.c
Kconfig
Makefile
netns.h
rpc_pipe.c
rpcb_clnt.c
sched.c
socklib.c
stats.c
sunrpc.h
sunrpc_syms.c
svc.c
svc_xprt.c svcrdma: Fix leak of svc_rdma_recv_ctxt objects 2020-05-02 08:48:48 +02:00
svcauth.c
svcauth_unix.c
svcsock.c svcrdma: Fix leak of svc_rdma_recv_ctxt objects 2020-05-02 08:48:48 +02:00
sysctl.c
timer.c
xdr.c SUNRPC: Revert 241b1f419f ("SUNRPC: Remove xdr_buf_trim()") 2020-05-20 08:20:39 +02:00
xprt.c
xprtmultipath.c
xprtsock.c SUNRPC: Fix backchannel RPC soft lockups 2020-04-29 16:33:18 +02:00