From c7abc34dbb75d0dfe1bb5068e81d4f575f5af6ba Mon Sep 17 00:00:00 2001 From: liubaojiang <1838095916@qq.com> Date: Fri, 10 Dec 2021 00:02:57 +0800 Subject: [PATCH] rename operation returns the correct old parent path --- weed/filesys/dir_rename.go | 2 +- weed/server/filer_grpc_server_rename.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/weed/filesys/dir_rename.go b/weed/filesys/dir_rename.go index 8a80559f6..1ee6922d8 100644 --- a/weed/filesys/dir_rename.go +++ b/weed/filesys/dir_rename.go @@ -111,7 +111,7 @@ func (dir *Dir) handleRenameResponse(ctx context.Context, resp *filer_pb.StreamR // change file handle inodeId := oldPath.AsInode() dir.wfs.handlesLock.Lock() - if existingHandle, found := dir.wfs.handles[inodeId]; found && existingHandle == nil { + if existingHandle, found := dir.wfs.handles[inodeId]; found && existingHandle != nil { glog.V(4).Infof("opened file handle %s => %s", oldPath, newPath) delete(dir.wfs.handles, inodeId) dir.wfs.handles[newPath.AsInode()] = existingHandle diff --git a/weed/server/filer_grpc_server_rename.go b/weed/server/filer_grpc_server_rename.go index a7f428848..62bcccabb 100644 --- a/weed/server/filer_grpc_server_rename.go +++ b/weed/server/filer_grpc_server_rename.go @@ -159,7 +159,7 @@ func (fs *FilerServer) moveSelfEntry(ctx context.Context, stream filer_pb.Seawee } if stream != nil { if err := stream.Send(&filer_pb.StreamRenameEntryResponse{ - Directory: string(newParent), + Directory: string(oldParent), EventNotification: &filer_pb.EventNotification{ OldEntry: &filer_pb.Entry{ Name: entry.Name(),