Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

mount2: adjust file mode

chrislue8ce30fdc591
diff --git a/weed/mount/weedfs_attr.go b/weed/mount/weedfs_attr.go
index 4042ce8f12..9f995608c7 100644
--- a/weed/mount/weedfs_attr.go
+++ b/weed/mount/weedfs_attr.go
@@ -66,7 +66,7 @@ func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse
}
if mode, ok := input.GetMode(); ok {
- entry.Attributes.FileMode = uint32(mode)
+ entry.Attributes.FileMode = mode & 07777
}
if uid, ok := input.GetUID(); ok {
@@ -81,6 +81,10 @@ func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse
entry.Attributes.Mtime = mtime.Unix()
}
+ if atime, ok := input.GetATime(); ok {
+ entry.Attributes.Mtime = atime.Unix()
+ }
+
entry.Attributes.Mtime = time.Now().Unix()
out.AttrValid = 1
wfs.setAttrByPbEntry(&out.Attr, input.NodeId, entry)
diff --git a/weed/mount/weedfs_file_mkrm.go b/weed/mount/weedfs_file_mkrm.go
index 6c06e19472..9e19c8b540 100644
--- a/weed/mount/weedfs_file_mkrm.go
+++ b/weed/mount/weedfs_file_mkrm.go
@@ -45,7 +45,7 @@ func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out
Attributes: &filer_pb.FuseAttributes{
Mtime: time.Now().Unix(),
Crtime: time.Now().Unix(),
- FileMode: uint32(toFileMode(in.Mode) &^ wfs.option.Umask),
+ FileMode: uint32(toFileMode(in.Mode)),
Uid: in.Uid,
Gid: in.Gid,
Collection: wfs.option.Collection,
diff --git a/weed/mount/weedfs_file_sync.go b/weed/mount/weedfs_file_sync.go
index 29a13690b7..8fb7c73b49 100644
--- a/weed/mount/weedfs_file_sync.go
+++ b/weed/mount/weedfs_file_sync.go
@@ -7,7 +7,6 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/hanwen/go-fuse/v2/fuse"
- "os"
"time"
)
@@ -129,7 +128,6 @@ func (wfs *WFS) doFlush(fh *FileHandle, uid, gid uint32) fuse.Status {
entry.Attributes.Crtime = time.Now().Unix()
}
entry.Attributes.Mtime = time.Now().Unix()
- entry.Attributes.FileMode = uint32(os.FileMode(entry.Attributes.FileMode) &^ wfs.option.Umask)
entry.Attributes.Collection, entry.Attributes.Replication = fh.dirtyPages.GetStorageOptions()
}
diff --git a/weed/mount/weedfs_symlink.go b/weed/mount/weedfs_symlink.go
index 44477d765b..eb8169d70e 100644
--- a/weed/mount/weedfs_symlink.go
+++ b/weed/mount/weedfs_symlink.go
@@ -32,7 +32,7 @@ func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target st
Attributes: &filer_pb.FuseAttributes{
Mtime: time.Now().Unix(),
Crtime: time.Now().Unix(),
- FileMode: uint32((os.FileMode(0777) | os.ModeSymlink) &^ wfs.option.Umask),
+ FileMode: uint32(os.FileMode(0777) | os.ModeSymlink),
Uid: header.Uid,
Gid: header.Gid,
SymlinkTarget: target,