mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-19 02:15:02 +01:00
mount: follow a peer unlink to the surviving hard link for closed inodes (#12737)
* mount: drop a peer-unlinked name only while its inode keeps another Move the survivor check from followSurvivingLink into InodeToPath.RemoveAlias so the check and the removal happen under one table lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: follow a peer unlink to the surviving hard link for closed inodes A peer deleting one name of a hard link only moved an open handle to the surviving name. A closed inode kept the deleted name as its primary path, so the next open by the kernel's nodeid failed with ENOENT. Co-authored-by: skymazer <54621405+skymazer@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: share the cached-entry freshness check of peer invalidations Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a name a local rename reclaimed before the peer unlink arrived Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a name a local rename or link gave the inode after an older peer delete The cached-entry check only covers a cached parent. InodeToPath now records, per hard-linked inode, the newest name a local rename or link gave it with the filer stamp, and the closed-inode peer-delete path keeps that name when the delete is older. The record lives in a side map dropped on Forget, so InodeEntry keeps its size class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: sign rename stream responses with the filer signature A rename response carries the stamp of the filer that applied it, so the mount can tell which clock the stamp belongs to, as it does for create acks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: order a peer delete against a local rename or link only on one filer clock The stamp of a local rename or link comes from the filer that applied it, and a delete logged by another filer runs on a different clock. Keep the name only when both carry the same nonzero filer signature; otherwise drop it as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drop the local-name stamp fence for uncached parents Ordering a delayed peer delete against a local rename by filer stamp needs a record per alias, a shared filer clock, and the open-handle path to follow; that is a larger change than this fix. Back to the cached-entry check, which covers a cached parent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: skymazer <54621405+skymazer@users.noreply.github.com>
This commit is contained in:
4 files changed
+133
-18
No files matched your search
@@ -629,6 +629,32 @@ func (i *InodeToPath) RemovePath(path util.FullPath, onStillReferenced func(inod
|
||||
delete(i.wasCachedDirs, path)
|
||||
}
|
||||
|
||||
// RemoveAlias drops a name only while its inode keeps another one, returning
|
||||
// the inode's primary path afterwards. A sole name stays for a delayed rename
|
||||
// to move.
|
||||
func (i *InodeToPath) RemoveAlias(path util.FullPath) (util.FullPath, bool) {
|
||||
i.Lock()
|
||||
defer i.Unlock()
|
||||
inode, found := i.path2inode[path]
|
||||
if !found {
|
||||
return "", false
|
||||
}
|
||||
ie := i.inode2path[inode]
|
||||
if ie == nil {
|
||||
return "", false
|
||||
}
|
||||
survives := false
|
||||
for _, p := range ie.appendPaths(nil) {
|
||||
survives = survives || p != path
|
||||
}
|
||||
if !survives {
|
||||
return "", false
|
||||
}
|
||||
delete(i.path2inode, path)
|
||||
ie.removeOnePath(path)
|
||||
return ie.path, true
|
||||
}
|
||||
|
||||
func (i *InodeToPath) removePathFromInode2Path(inode uint64, path util.FullPath) {
|
||||
ie, found := i.inode2path[inode]
|
||||
if !found {
|
||||
|
||||
Reference in new issue
Block a user