Re: [PATCH] sunrpc: fix xs_read_xdr_buf for partial pages receive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux