[26.04-linux-nvidia] Backport: fuse: back uncached readdir buffers with pages#459
Closed
nvmochs wants to merge 1 commit into
Closed
[26.04-linux-nvidia] Backport: fuse: back uncached readdir buffers with pages#459nvmochs wants to merge 1 commit into
nvmochs wants to merge 1 commit into
Conversation
Commit dabb903 ("fuse: increase readdir buffer size") changed fuse_readdir_uncached() to size its temporary buffer from ctx->count. This is useful for overlayfs and other in-kernel callers that use INT_MAX to indicate an unlimited directory read. The larger buffer is currently supplied as a kvec output argument. For virtiofs, kvec arguments are copied through req->argbuf, which is allocated with kmalloc(..., GFP_ATOMIC). A large uncached readdir buffer can therefore require a multi-megabyte contiguous atomic allocation before the request is queued. Avoid the large bounce-buffer allocation by backing uncached readdir output with pages and setting out_pages. Transports such as virtiofs can then pass the pages as scatter-gather entries instead of copying the output through argbuf. Map the pages with vm_map_ram() only while parsing the returned dirents. The existing parser can then continue to use a linear kernel mapping. [SzM: separate allocation of pages into a helper function] Fixes: dabb903 ("fuse: increase readdir buffer size") Cc: stable@vger.kernel.org Signed-off-by: Matthew R. Ochs <mochs@nvidia.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> (cherry picked from commit 2fcb1dd15faba5657b825cc5d54423251c70e79a linux-next) Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
Contributor
PR Validation ReportPatchscan ✅ No Missing FixesAll cherry-picked commits checked — no missing upstream fixes found. PR Lint ❌ Errors foundDetailsChecking 1 commits...
Cherry-pick digest:
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local │ Referenced upstream / Patch subject │ Patch-ID │ Subject │ SoB chain │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3d12b88b9368 │ [SAUCE] fuse: back uncached readdir buffers with pages │ N/A │ N/A │ mochs, mszeredi, mochs │
└──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘
Lint results:
E: 3d12b88b9368 ("fuse: back uncached readdir buffers with pages"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
|
clsotog
approved these changes
Jun 12, 2026
clsotog
left a comment
Collaborator
There was a problem hiding this comment.
Acked-by: Carol L Soto <csoto@nvidia.com>
Collaborator
BaseOS Kernel ReviewSummaryIn fuse readdir (fs/fuse/readdir.c:396), switching uncached readdir buffers to vm_map_ram()/vm_unmap_ram() will panic on NOMMU systems where those calls are BUG(), unlike the prior kvmalloc() path; since FUSE_FS has no MMU dependency, this is a NOMMU regression. Findings: Critical: 1, High: 0, Medium: 0, Low: 0 Latest watcher review: open review Kernel deb build: successful (download debs, 4 files) Head: This comment is maintained by nv-pr-bot. It is updated when the GitHub watcher publishes a newer review. |
Collaborator
|
|
Collaborator
Author
|
Merged, closing PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates FUSE uncached readdir to back the temporary output buffer with pages and set out_pages, instead of passing the buffer as a kvec output argument.
For virtiofs, kvec output arguments are copied through req->argbuf, which is allocated with kmalloc(..., GFP_ATOMIC). Large uncached readdir requests can therefore require a multi-megabyte contiguous atomic allocation before the request is queued. Using output pages lets transports such as virtiofs pass the buffer as scatter-gather entries instead.
The existing uncached readdir buffer sizing is unchanged. Pages are mapped with vm_map_ram() only while parsing returned dirents.
LKML:
[PATCH v4] fuse: back uncached readdir buffers with pages - https://lore.kernel.org/all/20260526152021.891412-1-mochs@nvidia.com/
linux-next:
2fcb1dd15fab fuse: back uncached readdir buffers with pages
Testing
Validated the original failing configuration:
Command:
Result:
This is the configuration that previously failed with Cannot allocate memory.
LP: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia/+bug/2156632
NVbug: 6059208