aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/dir_rename.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filesys/dir_rename.go')
-rw-r--r--weed/filesys/dir_rename.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/weed/filesys/dir_rename.go b/weed/filesys/dir_rename.go
index 8309b238a..6b68e4ee9 100644
--- a/weed/filesys/dir_rename.go
+++ b/weed/filesys/dir_rename.go
@@ -2,7 +2,6 @@ package filesys
import (
"context"
- "fmt"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
@@ -16,7 +15,10 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector
newDir := newDirectory.(*Dir)
glog.V(4).Infof("dir Rename %s/%s => %s/%s", dir.Path, req.OldName, newDir.Path, req.NewName)
- err := dir.wfs.WithFilerClient(ctx, func(client filer_pb.SeaweedFilerClient) error {
+ dir.wfs.cacheDelete(filer2.NewFullPath(newDir.Path, req.NewName))
+ dir.wfs.cacheDelete(filer2.NewFullPath(dir.Path, req.OldName))
+
+ return dir.wfs.WithFilerClient(ctx, func(client filer_pb.SeaweedFilerClient) error {
request := &filer_pb.AtomicRenameEntryRequest{
OldDirectory: dir.Path,
@@ -27,19 +29,11 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector
_, err := client.AtomicRenameEntry(ctx, request)
if err != nil {
- return fmt.Errorf("renaming %s/%s => %s/%s: %v", dir.Path, req.OldName, newDir.Path, req.NewName, err)
+ glog.V(0).Infof("dir Rename %s/%s => %s/%s : %v", dir.Path, req.OldName, newDir.Path, req.NewName, err)
+ return fuse.EIO
}
return nil
})
-
- if err == nil {
- oldpath := string(filer2.NewFullPath(dir.Path, req.OldName))
- newpath := string(filer2.NewFullPath(newDir.Path, req.NewName))
- dir.wfs.listDirectoryEntriesCache.Delete(oldpath)
- dir.wfs.listDirectoryEntriesCache.Delete(newpath)
- }
-
- return err
}