mbox series

[v2,0/5] Fix NFSv3 READDIRPLUS failures

Message ID 165463444560.38298.18296069287423675496.stgit@bazille.1015granger.net (mailing list archive)
Headers show
Series Fix NFSv3 READDIRPLUS failures | expand

Message

Chuck Lever June 7, 2022, 8:47 p.m. UTC
NFSD's new READDIRPLUS dirent encoder blows past the end of the
directory payload xdr_stream when the client requests more than a
page worth of directory entries. I tracked this down to how
xdr_get_next_encode_buffer() computes xdr->end. First patch in this
series is the fix. The remaining patches are clean-ups and
optimizations.

I want to get this series into 5.19-rc quickly. I would appreciate
getting one more R-b for this series, preferrably from one of the
NFS client maintainers.


Changes since v1:
- Adjusted patch 2/5 per Neil Brown's suggestion
- Series applied to my NFS client and tested there

---

Chuck Lever (5):
      SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()
      SUNRPC: Optimize xdr_reserve_space()
      SUNRPC: Clean up xdr_commit_encode()
      SUNRPC: Clean up xdr_get_next_encode_buffer()
      SUNRPC: Remove pointer type casts from xdr_get_next_encode_buffer()


 include/linux/sunrpc/xdr.h | 16 +++++++++++++++-
 net/sunrpc/xdr.c           | 37 +++++++++++++++++++++++--------------
 2 files changed, 38 insertions(+), 15 deletions(-)

--
Chuck Lever

Comments

J. Bruce Fields June 8, 2022, 4:31 p.m. UTC | #1
Looks good.  Feel free to add my reviewed-by:.

Do we have a test that reads a large enough directory?  Seems like that
plus the right kernel debugging options should have caught the original
bug.

--b.

On Tue, Jun 07, 2022 at 04:47:45PM -0400, Chuck Lever wrote:
> NFSD's new READDIRPLUS dirent encoder blows past the end of the
> directory payload xdr_stream when the client requests more than a
> page worth of directory entries. I tracked this down to how
> xdr_get_next_encode_buffer() computes xdr->end. First patch in this
> series is the fix. The remaining patches are clean-ups and
> optimizations.
> 
> I want to get this series into 5.19-rc quickly. I would appreciate
> getting one more R-b for this series, preferrably from one of the
> NFS client maintainers.
> 
> 
> Changes since v1:
> - Adjusted patch 2/5 per Neil Brown's suggestion
> - Series applied to my NFS client and tested there
> 
> ---
> 
> Chuck Lever (5):
>       SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()
>       SUNRPC: Optimize xdr_reserve_space()
>       SUNRPC: Clean up xdr_commit_encode()
>       SUNRPC: Clean up xdr_get_next_encode_buffer()
>       SUNRPC: Remove pointer type casts from xdr_get_next_encode_buffer()
> 
> 
>  include/linux/sunrpc/xdr.h | 16 +++++++++++++++-
>  net/sunrpc/xdr.c           | 37 +++++++++++++++++++++++--------------
>  2 files changed, 38 insertions(+), 15 deletions(-)
> 
> --
> Chuck Lever
Chuck Lever June 8, 2022, 4:35 p.m. UTC | #2
> On Jun 8, 2022, at 12:31 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> 
> Looks good.  Feel free to add my reviewed-by:.

Thanks!


> Do we have a test that reads a large enough directory?

Yes. I've been using a script that downloads and builds git, then runs
its unit test suite. That generates multi-page directory entry payloads.


> Seems like that
> plus the right kernel debugging options should have caught the original
> bug.

Yep, it triggered svcrdma_small_wrch_err.


--
Chuck Lever