From: "J. Bruce Fields" <bfields@fieldses.org>
To: Anna Schumaker <schumaker.anna@gmail.com>
Cc: "J. Bruce Fields" <bfields@redhat.com>,
Chuck Lever <chuck.lever@oracle.com>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v5 2/5] NFSD: Add READ_PLUS data support
Date: Wed, 9 Sep 2020 16:50:20 -0400 [thread overview]
Message-ID: <20200909205020.GE3894@fieldses.org> (raw)
In-Reply-To: <20200909202534.GC3894@fieldses.org>
On Wed, Sep 09, 2020 at 04:25:34PM -0400, bfields wrote:
> On Wed, Sep 09, 2020 at 12:53:18PM -0400, Anna Schumaker wrote:
> > On Tue, Sep 8, 2020 at 3:42 PM J. Bruce Fields <bfields@redhat.com> wrote:
> > >
> > > On Tue, Sep 08, 2020 at 12:25:56PM -0400, schumaker.anna@gmail.com wrote:
> > > > From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> > > >
> > > > This patch adds READ_PLUS support for returning a single
> > > > NFS4_CONTENT_DATA segment to the client. This is basically the same as
> > > > the READ operation, only with the extra information about data segments.
> > > >
> > > > Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> > > >
> > > > ---
> > > > v5: Fix up nfsd4_read_plus_rsize() calculation
> > > > ---
> > > > fs/nfsd/nfs4proc.c | 20 +++++++++++
> > > > fs/nfsd/nfs4xdr.c | 83 ++++++++++++++++++++++++++++++++++++++++++++--
> > > > 2 files changed, 101 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> > > > index eaf50eafa935..0a3df5f10501 100644
> > > > --- a/fs/nfsd/nfs4proc.c
> > > > +++ b/fs/nfsd/nfs4proc.c
> > > > @@ -2591,6 +2591,19 @@ static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
> > > > return (op_encode_hdr_size + 2 + XDR_QUADLEN(rlen)) * sizeof(__be32);
> > > > }
> > > >
> > > > +static inline u32 nfsd4_read_plus_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
> > > > +{
> > > > + u32 maxcount = svc_max_payload(rqstp);
> > > > + u32 rlen = min(op->u.read.rd_length, maxcount);
> > > > + /*
> > > > + * Worst case is a single large data segment, so make
> > > > + * sure we have enough room to encode that
> > > > + */
> > >
> > > After the last patch we allow an unlimited number of segments. So a
> > > zillion 1-byte segments is also possible, and is a worse case.
> > >
> > > Possible ways to avoid that kind of thing:
> > >
> > > - when encoding, stop and return a short read if the xdr-encoded
> > > result would exceed the limit calculated here.
> >
> > Doesn't this happen automatically through calls to xdr_reserve_space()?
>
> No, xdr_reserve_space() will keep us from running out of buffer
> completely, but it won't check that ops come in under the estimates made
> in read_plus_rsize().
If it's easier, another option might be just: if we ever get a "small"
hole (say, less than 512 bytes), just give up and encode the rest of the
result as a single big data segment.
--b.
next prev parent reply other threads:[~2020-09-09 20:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 16:25 [PATCH v5 0/5] NFSD: Add support for the v4.2 READ_PLUS operation schumaker.anna
2020-09-08 16:25 ` [PATCH v5 1/5] SUNRPC/NFSD: Implement xdr_reserve_space_vec() schumaker.anna
2020-09-08 16:25 ` [PATCH v5 2/5] NFSD: Add READ_PLUS data support schumaker.anna
2020-09-08 19:42 ` J. Bruce Fields
2020-09-09 16:53 ` Anna Schumaker
2020-09-09 20:25 ` J. Bruce Fields
2020-09-09 20:50 ` J. Bruce Fields [this message]
2020-09-08 16:25 ` [PATCH v5 3/5] NFSD: Add READ_PLUS hole segment encoding schumaker.anna
2020-09-08 16:25 ` [PATCH v5 4/5] NFSD: Return both a hole and a data segment schumaker.anna
2020-09-08 19:49 ` J. Bruce Fields
2020-09-09 16:51 ` Anna Schumaker
2020-09-09 20:24 ` J. Bruce Fields
2020-09-09 20:44 ` J. Bruce Fields
2020-09-08 16:25 ` [PATCH v5 5/5] NFSD: Encode a full READ_PLUS reply schumaker.anna
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=20200909205020.GE3894@fieldses.org \
--to=bfields@fieldses.org \
--cc=bfields@redhat.com \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=schumaker.anna@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.