mount: keep the pending link read when its name is already gone

A flush could read the removed alias name, find nothing, and drop the
pending read of the surviving link, leaving the stale base in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-11-13 01:46:13 -08:00
1 parent ffb40f0933
commit 8fcb21c977
1 file changed
+7 -3
+7 -3
View File
@@ -267,15 +267,19 @@ func (fh *FileHandle) adoptLinkChangeLocked(stored *filer_pb.Entry, versionTsNs
}
// adoptStoredLink reads the entry stored at path and adopts it as a change of
// hardLinkId. A failed read leaves the id on the handle, so its next flush
// reads again instead of publishing over a base the change made stale. The
// caller holds the handle's lock.
// hardLinkId. A failed read, or a path already gone, leaves the id on the
// handle, so its next flush reads again instead of publishing over a base the
// change made stale. The caller holds the handle's lock.
func (wfs *WFS) adoptStoredLink(ctx context.Context, fh *FileHandle, path util.FullPath, hardLinkId []byte) error {
stored, tsNs, signature, err := filer_pb.GetEntry(ctx, wfs, path)
if err != nil && !errors.Is(err, filer_pb.ErrNotFound) {
fh.linkRefresh = hardLinkId
return err
}
if stored == nil {
fh.linkRefresh = hardLinkId
return nil
}
fh.linkRefresh = nil
if bytes.Equal(stored.GetHardLinkId(), hardLinkId) {
fh.adoptLinkChangeLocked(stored, tsNs, signature)