* mount: answer ESTALE for an inode the kernel holds but whose name is gone
A rename over an existing file drops the replaced inode's path in
InodeToPath.MovePath as soon as the rename's response arrives from the
filer, which sends it before it commits. Until the RENAME reply reaches
the kernel, the kernel still maps the name to the old inode, so an open,
stat, access or xattr call resolved in that window reaches maybeReadEntry
or AcquireHandle for an inode without a path and fails with ENOENT,
although the name exists. A rename made through another mount opens the
same window for as long as this kernel keeps the name's dentry. A process
polling a file that another one replaces with tmp + rename sees sporadic
ENOENT; a slow commit turns the window into a burst.
While the kernel has not forgotten the inode, answer ESTALE: the kernel
redoes the path walk once with LOOKUP_REVAL and opens the current entry,
as on NFS. A forgotten inode keeps ENOENT.
One writer replacing a file with tmp + os.replace and four readers opening
it in a loop on one mount, for 120 s: each reader got 897k-967k ENOENT
before (130k reads succeeded), none after (272k reads). With the readers
on a second mount that also lists the directory: 1,277-1,550 errors per
reader before, 7-13 after, at about 140 replacements a second.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: answer ESTALE for a pathless inode only on Linux
Only the Linux VFS redoes a path walk on ESTALE (LOOKUP_REVAL). FUSE on
macOS and FreeBSD purges the vnode's name cache when GETATTR or OPEN
answers ENOENT, so the next lookup finds the replacing file; ESTALE skips
that purge and keeps failing until the entry times out. WinFsp maps the
unknown errno to EIO. Keep ENOENT there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Concurrent writers to one file from different mounts require -dlm; without it, a conflicting write fails with EIO and the file may refuse further appends until reopened after the cache drops.