diff --git a/weed/mount/weedfs_link.go b/weed/mount/weedfs_link.go index 49c8053be1..bcf1cc137e 100644 --- a/weed/mount/weedfs_link.go +++ b/weed/mount/weedfs_link.go @@ -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)