mount: rename also invalidate source inode

This commit is contained in:
chrislu
2022-07-08 19:07:03 -07:00
parent 48382676d2
commit d685b94102
2 changed files with 11 additions and 5 deletions

View File

@@ -233,10 +233,16 @@ func (wfs *WFS) handleRenameResponse(ctx context.Context, resp *filer_pb.StreamR
oldPath := oldParent.Child(oldName)
newPath := newParent.Child(newName)
replacedInode := wfs.inodeToPath.MovePath(oldPath, newPath)
sourceInode, targetInode := wfs.inodeToPath.MovePath(oldPath, newPath)
if sourceInode != 0 {
if fh := wfs.fhmap.inode2fh[sourceInode]; foundFh && fh.entry != nil {
fh.entry.Name = newName
}
wfs.fuseServer.InodeNotify(sourceInode, 0, -1)
}
// invalidate attr and data
if replacedInode > 0 {
wfs.fuseServer.InodeNotify(replacedInode, 0, -1)
if targetInode != 0 {
wfs.fuseServer.InodeNotify(targetInode, 0, -1)
}
} else if resp.EventNotification.OldEntry != nil {