Re: [PATCH v1 1/5] SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()

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

 



On Tue, 07 Jun 2022, Chuck Lever III wrote:
> > On Jun 6, 2022, at 10:35 PM, Chuck Lever III <chuck.lever@xxxxxxxxxx> wrote:
> > 
> >> On Jun 6, 2022, at 8:59 PM, NeilBrown <neilb@xxxxxxx> wrote:
> >> We then assign frag{1,2}bytes and have another chunk of code that looks
> >> wrong to me.  I'd like
> >> 
> >>  if (xdr->iov) {
> >> 	xdr->iov->iov_len += frag1bytes;
> >> 	xdr->iov = NULL;
> >>  } else {
> >>       xdr->buf->page_len += frag1bytes;
> >>       xdr->page_ptr++;
> >>  }
> >> 
> >> Note that this changes the code NOT to increment pagE_ptr if iov was not
> >> NULL.  I cannot see how it would be correct to do that.  Presumably this
> >> code is never called with iov != NULL ???
> > 
> > That strikes me as a good change. I will add it to this series as
> > another patch.
> > 
> > Yes, this code is called by the server's READDIR encoder with iov = NULL.
> > See nfsd3_init_dirlist_pages().
> 
> This change breaks READDIR, looks like.

Thanks for testing...

I looked again, and I see that svcxdr_init_encode() initialises
->page_ptr to "buf->page - 1".  So we need a +1 when moving from the
'head' to the pages.

Commit 05638dc73af2 ("nfsd4: simplify server xdr->next_page use")

explains why.  I'm not sure I completely agree with the reasoning (head
really is a special case), but it probably isn't worth "fixing".

Thanks,
NeilBrown

> 
> --
> Chuck Lever
> 
> 
> 
> 




[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