linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Aloni <dan@kernelim.com>
To: Trond Myklebust <trondmy@hammerspace.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] sunrpc: fix xs_read_xdr_buf for partial pages receive
Date: Sat, 5 Dec 2020 11:29:05 +0200	[thread overview]
Message-ID: <20201205092905.GA1943555@gmail.com> (raw)
In-Reply-To: <528fd4a869f0757e0a60e9c733d4625067693588.camel@hammerspace.com>

On Fri, Dec 04, 2020 at 08:52:55PM +0000, Trond Myklebust wrote:
> On Fri, 2020-12-04 at 20:34 +0200, Dan Aloni wrote:
[..]
> > --- a/net/sunrpc/xprtsock.c
> > +++ b/net/sunrpc/xprtsock.c
> > @@ -436,7 +436,7 @@ xs_read_xdr_buf(struct socket *sock, struct
> > msghdr *msg, int flags,
> >                 offset += ret - buf->page_base;
> >                 if (offset == count || msg->msg_flags &
> > (MSG_EOR|MSG_TRUNC))
> >                         goto out;
> > -               if (ret != want)
> > +               if (ret - buf->page_base != want)
> >                         goto out;
> >                 seek = 0;
> >         } else {
> 
> Ouch... Well spotted!
> 
> Hmm... I think we want to just subtract out the buf->page_base from the
> value of 'ret' after we call xs_flush_bvec() and then adjust the
> calculation of 'offset' in the next line. That's more efficient.

Yes, it works out, though after being aware that the positive value of
`ret` when returned from `xs_read_xdr_buf` and propagated upward has no
effect except on traces.

-- 
Dan Aloni

      parent reply	other threads:[~2020-12-05  9:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 18:34 [PATCH] sunrpc: fix xs_read_xdr_buf for partial pages receive Dan Aloni
2020-12-04 20:52 ` Trond Myklebust
2020-12-05  9:28   ` [PATCH v2] " Dan Aloni
2020-12-05  9:29   ` Dan Aloni [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=20201205092905.GA1943555@gmail.com \
    --to=dan@kernelim.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@hammerspace.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).