fix(mount): fall through to filer when cached dir misses a tracked inode (#9436)

lookupEntry returned ENOENT whenever the metaCache had the parent marked
cached but the child entry was absent. That's only correct when the
kernel has no record of the path either — when inodeToPath still maps
it, the three layers disagree (#9139). Triggers in practice under bursts
of concurrent metadata ops and after delete/rename events from another
mount drop the local entry without clearing the inode mapping; the test
flake fixed in b94ad8247 was the same shape on a smaller scale.

Trust the filer in that case: fall through to the existing
GetEntry path, which already loudly logs (Warningf with layer state)
when the filer also returns ErrNotFound, and otherwise serves the live
entry. Drop the Warningf from the cached-dir miss branch; it fires
thousands of times under 16-task rclone imports while the real error
path downstream covers the genuine-drift signal.
This commit is contained in:
Chris Lu
2026-05-11 11:50:37 -07:00
committed by GitHub
parent 514ba7a233
commit 6d12ebeefe
+7 -8
View File
@@ -583,16 +583,15 @@ func (wfs *WFS) lookupEntry(fullpath util.FullPath) (*filer.Entry, fuse.Status)
// our IsDirectoryCached check and FindEntry (e.g. markDirectoryReadThrough).
// If it's no longer cached, fall through to the filer lookup below.
if wfs.metaCache.IsDirectoryCached(dirPath) {
// If the kernel is still tracking this path's inode, the entry
// was known to exist recently; a cached-dir miss here suggests
// metaCache/parent-cache coherence drift. Log visibly so the
// next occurrence shows up in mount.log without -v=4.
if _, inodeFound := wfs.inodeToPath.GetInode(fullpath); inodeFound {
glog.Warningf("lookupEntry: %s missing from cache while parent %s is cached; inode still tracked (possible coherence bug)", fullpath, dirPath)
} else {
// Authoritative ENOENT only if inodeToPath also has no record.
// If the kernel still tracks this inode, the three layers
// disagree; trust the filer over the local cache (the
// filer-ErrNotFound branch below logs the confirmed drift).
if _, inodeFound := wfs.inodeToPath.GetInode(fullpath); !inodeFound {
glog.V(4).Infof("lookupEntry cache miss (dir cached) %s", fullpath)
return nil, fuse.ENOENT
}
return nil, fuse.ENOENT
glog.V(2).Infof("lookupEntry: %s missing from cache while parent %s is cached; inode tracked, consulting filer", fullpath, dirPath)
}
}