NFSD: Cap rsize_bop result based on send buffer size
authorChuck Lever <chuck.lever@oracle.com>
Thu, 1 Sep 2022 19:29:55 +0000 (15:29 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 26 Sep 2022 18:02:50 +0000 (14:02 -0400)
commit76ce4dcec0dc08a032db916841ddc4e3998be317
treea6197a1be388b7434fdc201b6306b41807c0ff36
parent781fde1a2ba2391f31142f46f964cf1148ca1791
NFSD: Cap rsize_bop result based on send buffer size

Since before the git era, NFSD has conserved the number of pages
held by each nfsd thread by combining the RPC receive and send
buffers into a single array of pages. This works because there are
no cases where an operation needs a large RPC Call message and a
large RPC Reply at the same time.

Once an RPC Call has been received, svc_process() updates
svc_rqst::rq_res to describe the part of rq_pages that can be
used for constructing the Reply. This means that the send buffer
(rq_res) shrinks when the received RPC record containing the RPC
Call is large.

Add an NFSv4 helper that computes the size of the send buffer. It
replaces svc_max_payload() in spots where svc_max_payload() returns
a value that might be larger than the remaining send buffer space.
Callers who need to know the transport's actual maximum payload size
will continue to use svc_max_payload().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4proc.c