linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: NeilBrown <neilb@suse.com>
Cc: Jeff Layton <jlayton@kernel.org>,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfsd: allow nfsv3 readdir request to be larger.
Date: Fri, 8 Mar 2019 14:29:47 -0500	[thread overview]
Message-ID: <20190308192947.GA27011@fieldses.org> (raw)
In-Reply-To: <87y35rr52t.fsf@notabene.neil.brown.name>

Thanks!  Applied.

On Thu, Mar 07, 2019 at 09:49:46AM +1100, NeilBrown wrote:
> 
> nfsd currently reports the NFSv4 dtpref FSINFO parameter

(Just changed NFSv4 here to NFSv3.)--b.

> 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>
> ---
>  fs/nfsd/nfs3proc.c | 2 +-
>  fs/nfsd/nfs3xdr.c  | 4 +++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
> index c9cf46e0c040..8f933e84cec1 100644
> --- a/fs/nfsd/nfs3proc.c
> +++ b/fs/nfsd/nfs3proc.c
> @@ -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;
>  
> diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
> index 83919116d5cb..93fea246f676 100644
> --- a/fs/nfsd/nfs3xdr.c
> +++ b/fs/nfsd/nfs3xdr.c
> @@ -573,6 +573,8 @@ 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;
> @@ -580,7 +582,7 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p)
>  	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);
> -- 
> 2.14.0.rc0.dirty
> 



      reply	other threads:[~2019-03-08 19:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04  3:08 [PATCH] nfsd: fix memory corruption caused by readdir NeilBrown
2019-03-04 16:47 ` J. Bruce Fields
2019-03-04 23:48   ` NeilBrown
2019-03-05 21:42     ` J. Bruce Fields
2019-03-06 22:49       ` [PATCH] nfsd: allow nfsv3 readdir request to be larger NeilBrown
2019-03-08 19:29         ` J. Bruce Fields [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190308192947.GA27011@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).