mount: rename also invalidate source inode
This commit is contained in:
@@ -152,7 +152,7 @@ func (i *InodeToPath) RemovePath(path util.FullPath) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *InodeToPath) MovePath(sourcePath, targetPath util.FullPath) (replacedInode uint64) {
|
func (i *InodeToPath) MovePath(sourcePath, targetPath util.FullPath) (sourceInode, targetInode uint64) {
|
||||||
i.Lock()
|
i.Lock()
|
||||||
defer i.Unlock()
|
defer i.Unlock()
|
||||||
sourceInode, sourceFound := i.path2inode[sourcePath]
|
sourceInode, sourceFound := i.path2inode[sourcePath]
|
||||||
@@ -178,7 +178,7 @@ func (i *InodeToPath) MovePath(sourcePath, targetPath util.FullPath) (replacedIn
|
|||||||
} else {
|
} else {
|
||||||
glog.Errorf("MovePath %s to %s: sourceInode %d not found", sourcePath, targetPath, sourceInode)
|
glog.Errorf("MovePath %s to %s: sourceInode %d not found", sourcePath, targetPath, sourceInode)
|
||||||
}
|
}
|
||||||
return targetInode
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *InodeToPath) Forget(inode, nlookup uint64, onForgetDir func(dir util.FullPath)) {
|
func (i *InodeToPath) Forget(inode, nlookup uint64, onForgetDir func(dir util.FullPath)) {
|
||||||
|
|||||||
@@ -233,10 +233,16 @@ func (wfs *WFS) handleRenameResponse(ctx context.Context, resp *filer_pb.StreamR
|
|||||||
oldPath := oldParent.Child(oldName)
|
oldPath := oldParent.Child(oldName)
|
||||||
newPath := newParent.Child(newName)
|
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
|
// invalidate attr and data
|
||||||
if replacedInode > 0 {
|
if targetInode != 0 {
|
||||||
wfs.fuseServer.InodeNotify(replacedInode, 0, -1)
|
wfs.fuseServer.InodeNotify(targetInode, 0, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if resp.EventNotification.OldEntry != nil {
|
} else if resp.EventNotification.OldEntry != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user