]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
NFSD: Remove NFSD_BUFSIZE
authorChuck Lever <chuck.lever@oracle.com>
Mon, 28 Apr 2025 19:36:59 +0000 (15:36 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Thu, 15 May 2025 20:16:27 +0000 (16:16 -0400)
Clean up: The documenting comment for NFSD_BUFSIZE is quite stale.
NFSD_BUFSIZE is used only for NFSv4 Reply these days; never for
NFSv2 or v3, and never for RPC Calls. Even so, the byte count
estimate does not include the size of the NFSv4 COMPOUND Reply
HEADER or the RPC auth flavor.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4state.c
fs/nfsd/nfs4xdr.c
fs/nfsd/nfsd.h

index ffd8b1d499dfe24d4e6a74aa9446441c4870c715..f28c8726755f33116d1db8e13f7ef3f2e5ba62ab 100644 (file)
@@ -3845,7 +3845,7 @@ static const struct svc_procedure nfsd_procedures4[2] = {
                .pc_ressize = sizeof(struct nfsd4_compoundres),
                .pc_release = nfsd4_release_compoundargs,
                .pc_cachetype = RC_NOCACHE,
-               .pc_xdrressize = NFSD_BUFSIZE/4,
+               .pc_xdrressize = 3+NFSSVC_MAXBLKSIZE/4,
                .pc_name = "COMPOUND",
        },
 };
index 5f5bed2a0312cd73c98b2372719ea975c507f1b1..d5694987f86fadab985e55cce6261ad680e83b69 100644 (file)
@@ -4406,7 +4406,7 @@ nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                                    nfserr_rep_too_big;
        if (xdr_restrict_buflen(xdr, buflen - rqstp->rq_auth_slack))
                goto out_put_session;
-       svc_reserve(rqstp, buflen);
+       svc_reserve_auth(rqstp, buflen);
 
        status = nfs_ok;
        /* Success! accept new slot seqid */
index 9eb8e570462251fd857e43478448574264e7a0a0..b5742d86b88da73cbee35184b1ec1803db691a16 100644 (file)
@@ -2564,7 +2564,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
        /* Sessions make the DRC unnecessary: */
        if (argp->minorversion)
                cachethis = false;
-       svc_reserve(argp->rqstp, max_reply + readbytes);
+       svc_reserve_auth(argp->rqstp, max_reply + readbytes);
        argp->rqstp->rq_cachetype = cachethis ? RC_REPLBUFF : RC_NOCACHE;
 
        argp->splice_ok = nfsd_read_splice_ok(argp->rqstp);
index 232aee06223d59642233a75a9efe2471e2ac3b11..b9ac81023c13e2042b913d2f4339da74893b1826 100644 (file)
@@ -50,19 +50,6 @@ bool nfsd_support_version(int vers);
 /* NFSv2 is limited by the protocol specification, see RFC 1094 */
 #define NFSSVC_MAXBLKSIZE_V2    (8*1024)
 
-
-/*
- * Largest number of bytes we need to allocate for an NFS
- * call or reply.  Used to control buffer sizes.  We use
- * the length of v3 WRITE, READDIR and READDIR replies
- * which are an RPC header, up to 26 XDR units of reply
- * data, and some page data.
- *
- * Note that accuracy here doesn't matter too much as the
- * size is rounded up to a page size when allocating space.
- */
-#define NFSD_BUFSIZE            ((RPC_MAX_HEADER_WITH_AUTH+26)*XDR_UNIT + NFSSVC_MAXBLKSIZE)
-
 struct readdir_cd {
        __be32                  err;    /* 0, nfserr, or nfserr_eof */
 };