aboutsummaryrefslogtreecommitdiff
path: root/weed/mount
diff options
context:
space:
mode:
authorGuang Jiong Lou <7991675+27149chen@users.noreply.github.com>2024-10-22 23:46:18 +0800
committerGitHub <noreply@github.com>2024-10-22 08:46:18 -0700
commit9369a88c5c659753aeced2c6aa62d0264632c2ea (patch)
treed3bf81cfd07931153284566003ae8f5f7eb2a36a /weed/mount
parent970059d4ce07f439a48429bee677881f097ac7b9 (diff)
downloadseaweedfs-9369a88c5c659753aeced2c6aa62d0264632c2ea.tar.xz
seaweedfs-9369a88c5c659753aeced2c6aa62d0264632c2ea.zip
stop renaming worm files (#6154)
* stop renaming worm file Signed-off-by: lou <alex1988@outlook.com> * update after review Signed-off-by: lou <alex1988@outlook.com> * Update weed/server/filer_server_handlers_write.go --------- Signed-off-by: lou <alex1988@outlook.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Diffstat (limited to 'weed/mount')
-rw-r--r--weed/mount/weedfs_rename.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/weed/mount/weedfs_rename.go b/weed/mount/weedfs_rename.go
index f9fc85b3f..18ab427a2 100644
--- a/weed/mount/weedfs_rename.go
+++ b/weed/mount/weedfs_rename.go
@@ -3,15 +3,16 @@ package mount
import (
"context"
"fmt"
+ "io"
+ "strings"
+ "syscall"
+
"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/seaweedfs/weed/util"
- "io"
- "strings"
- "syscall"
)
/** Rename a file
@@ -160,6 +161,13 @@ func (wfs *WFS) Rename(cancel <-chan struct{}, in *fuse.RenameIn, oldName string
}
newPath := newDir.Child(newName)
+ if wfs.FilerConf != nil {
+ rule := wfs.FilerConf.MatchStorageRule(string(oldPath))
+ if rule.Worm {
+ return fuse.EPERM
+ }
+ }
+
glog.V(4).Infof("dir Rename %s => %s", oldPath, newPath)
// update remote filer