NAS-140523 / 27.0.0-BETA.1 / NFSD: return ESTALE for snapdir entries when export lookup fails#243
Merged
ixhamza merged 1 commit intotruenas/linux-6.18from Apr 3, 2026
Merged
Conversation
When nfsd_cross_mnt() crosses into a mounted ZFS snapshot but rqst_exp_get_by_name() fails to resolve the sub-export (-ENOENT), the error is silently converted to success and the automount stub dentry is returned to the caller. The stub has simple_dir_operations and its file handle is encoded with gen=1 (snapshot is mounted). This 44-byte gen=1 handle becomes a permanent trap: zfsctl_snapdir_vget() sees gen=1 matching d_mountpoint=true, returns the stub inode, and READDIR returns NFS4_OK with zero entries. The client caches this empty result indefinitely since there is no error signal to trigger re-resolution. The empty directory persists until change_info4 updates (e.g., manual snapshot creation on the server). For zfs_snapdir exports, return -ESTALE instead of silently falling back to the automount stub. This causes the client to re-resolve via LOOKUP. Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
anodos325
approved these changes
Apr 2, 2026
This was referenced Apr 3, 2026
|
This PR has been merged and conversations have been locked. |
Member
Author
|
time 20:00 |
|
Time tracking added. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
When
nfsd_cross_mnt()crosses into a mounted ZFS snapshot butrqst_exp_get_by_name()fails to resolve the sub-export (-ENOENT), the error is silently converted to success and the automount stub dentry is returned to the caller. The stub hassimple_dir_operationsand its file handle is encoded withgen=1(snapshot is mounted).This 44-byte
gen=1handle becomes a permanent trap:zfsctl_snapdir_vget()seesgen=1matchingd_mountpoint=true, returns the stub inode, andREADDIRreturnsNFS4_OKwith zero entries. The client caches this empty result indefinitely since there is no error signal to trigger re-resolution. The empty directory persists until change_info4 updates (e.g., manual snapshot creation on the server).For
zfs_snapdirexports, return-ESTALEinstead of silently falling back to the automount stub. This causes the client to re-resolve viaLOOKUP.Testing