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
> On Jun 8, 2022, at 12:31 PM, J. Bruce Fields <[email protected]> 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