Skip to content

Commit

Permalink
nfsd: allow nfsv3 readdir request to be larger.
Browse files Browse the repository at this point in the history
nfsd currently reports the NFSv3 dtpref FSINFO parameter
to be PAGE_SIZE, so NFS clients will typically ask for one
page of directory entries at a time.  This is needlessly restrictive
as nfsd can handle larger replies easily.

Also, a READDIR request (but not a READDIRPLUS request) has the count
size clipped to PAGE_SIE, again unnecessary.

This patch lifts these limits so that larger readdir requests can be
used.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
NeilBrown authored and J. Bruce Fields committed Mar 8, 2019
1 parent dd83882 commit f875a79
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/nfsd/nfs3proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
resp->f_wtmax = max_blocksize;
resp->f_wtpref = max_blocksize;
resp->f_wtmult = PAGE_SIZE;
resp->f_dtpref = PAGE_SIZE;
resp->f_dtpref = max_blocksize;
resp->f_maxfilesize = ~(u32) 0;
resp->f_properties = NFS3_FSF_DEFAULT;

Expand Down
4 changes: 3 additions & 1 deletion fs/nfsd/nfs3xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,16 @@ int
nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p)
{
struct nfsd3_readdirargs *args = rqstp->rq_argp;
u32 max_blocksize = svc_max_payload(rqstp);

p = decode_fh(p, &args->fh);
if (!p)
return 0;
p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2;
args->dircount = ~0;
args->count = ntohl(*p++);
args->count = min_t(u32, args->count, PAGE_SIZE);
args->count = min_t(u32, args->count, max_blocksize);
args->buffer = page_address(*(rqstp->rq_next_page++));

return xdr_argsize_check(rqstp, p);
Expand Down

0 comments on commit f875a79

Please sign in to comment.