mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-13 15:29:12 +01:00
mount: carry an alias unlink's stored entry into the open handle
Removing one of several hard links lowers the stored link count and stamps a new ctime, and the handle may still hold the removed name. Look up the entry at the name the handle flushes through and adopt it, so the next content flush matches the stored entry, writes the right count, and attribute saves address the surviving name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b819913920
commit
922117e227
1 file changed
+8
-2
@@ -1,6 +1,7 @@
|
||||
package mount
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"syscall"
|
||||
@@ -358,9 +359,14 @@ func (wfs *WFS) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name strin
|
||||
}
|
||||
|
||||
// Another link still names the inode, so its open handle keeps flushing
|
||||
// through that name.
|
||||
// through that name, over the count and ctime the filer stored there.
|
||||
if isHardLink && markedInode != 0 {
|
||||
if _, status := wfs.inodeToPath.GetPath(markedInode); status == fuse.OK {
|
||||
if survivor, status := wfs.inodeToPath.GetPath(markedInode); status == fuse.OK {
|
||||
if fh, found := wfs.fhMap.FindFileHandle(markedInode); found {
|
||||
if stored, tsNs, signature, err := filer_pb.GetEntry(ctx, wfs, survivor); err == nil && bytes.Equal(stored.GetHardLinkId(), entry.HardLinkId) {
|
||||
fh.adoptLinkChange(stored, tsNs, signature)
|
||||
}
|
||||
}
|
||||
wfs.clearHandleDeleted(markedInode, deleteEpoch)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user