mount: retain a recorded handle path only once it matches the file

A path read from the filer record was retained before the lookup checked
it, so a stale one kept answering ESTALE without reading the record again.
It is now retained right before LookupHandle, and never over a forgotten
inode or path the table already holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-11-25 23:15:12 -08:00
1 parent 1d0ff187c5
commit 9be2cb0b29
2 files changed
+10 -4

No files matched your search

+5 -2
View File
@@ -203,16 +203,19 @@ func (i *InodeToPath) moveForgotten(sourcePath, targetPath util.FullPath) bool {
}
// RememberForgotten retains path as that of a forgotten inode, one an earlier
// mount handed out, unless the inode is live.
// mount handed out, unless the table already knows the inode or the path.
func (i *InodeToPath) RememberForgotten(inode uint64, path util.FullPath) {
i.Lock()
defer i.Unlock()
if i.forgotten == nil {
if i.forgotten == nil || i.forgotten.Contains(inode) {
return
}
if _, live := i.inode2path[inode]; live {
return
}
if _, taken := i.forgottenInodes[path]; taken {
return
}
i.forgotten.Add(inode, path)
i.forgottenInodes[path] = inode
}
+5 -2
View File
@@ -58,7 +58,11 @@ func (wfs *WFS) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name strin
}
inode := possibleInode
if name == "." {
if !sameFile(inode, fullFilePath, localEntry) || !wfs.inodeToPath.LookupHandle(fullFilePath, inode, localEntry.IsDirectory()) {
if !sameFile(inode, fullFilePath, localEntry) {
return fuse.Status(syscall.ESTALE)
}
wfs.inodeToPath.RememberForgotten(inode, fullFilePath)
if !wfs.inodeToPath.LookupHandle(fullFilePath, inode, localEntry.IsDirectory()) {
return fuse.Status(syscall.ESTALE)
}
} else {
@@ -103,7 +107,6 @@ func (wfs *WFS) resolveDotName(ctx context.Context, nodeId uint64, name string)
if !forgotten.IsUnder(util.FullPath(wfs.option.FilerMountRootPath)) {
return "", 0, fuse.Status(syscall.ESTALE)
}
wfs.inodeToPath.RememberForgotten(nodeId, forgotten)
}
if inode, known := wfs.inodeToPath.GetInode(forgotten); known && inode != nodeId {
return "", 0, fuse.Status(syscall.ESTALE)