Browse Source

rename operation returns the correct old parent path

pull/2500/head
liubaojiang 3 years ago
parent
commit
c7abc34dbb
  1. 2
      weed/filesys/dir_rename.go
  2. 2
      weed/server/filer_grpc_server_rename.go

2
weed/filesys/dir_rename.go

@ -111,7 +111,7 @@ func (dir *Dir) handleRenameResponse(ctx context.Context, resp *filer_pb.StreamR
// change file handle // change file handle
inodeId := oldPath.AsInode() inodeId := oldPath.AsInode()
dir.wfs.handlesLock.Lock() 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) glog.V(4).Infof("opened file handle %s => %s", oldPath, newPath)
delete(dir.wfs.handles, inodeId) delete(dir.wfs.handles, inodeId)
dir.wfs.handles[newPath.AsInode()] = existingHandle dir.wfs.handles[newPath.AsInode()] = existingHandle

2
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 stream != nil {
if err := stream.Send(&filer_pb.StreamRenameEntryResponse{ if err := stream.Send(&filer_pb.StreamRenameEntryResponse{
Directory: string(newParent),
Directory: string(oldParent),
EventNotification: &filer_pb.EventNotification{ EventNotification: &filer_pb.EventNotification{
OldEntry: &filer_pb.Entry{ OldEntry: &filer_pb.Entry{
Name: entry.Name(), Name: entry.Name(),

Loading…
Cancel
Save