aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-18 00:47:02 -0800
committerchrislu <chris.lu@gmail.com>2022-02-18 00:47:02 -0800
commite8ce30fdc591df1cb86e7923e851414ca37453b3 (patch)
tree492d9186b0cfaebf225c75f15933063e121ef9d6
parentf9d33f70b0529451c583c2fe41685fbe4234069e (diff)
downloadseaweedfs-e8ce30fdc591df1cb86e7923e851414ca37453b3.tar.xz
seaweedfs-e8ce30fdc591df1cb86e7923e851414ca37453b3.zip
mount2: adjust file mode
-rw-r--r--weed/mount/weedfs_attr.go6
-rw-r--r--weed/mount/weedfs_file_mkrm.go2
-rw-r--r--weed/mount/weedfs_file_sync.go2
-rw-r--r--weed/mount/weedfs_symlink.go2
4 files changed, 7 insertions, 5 deletions
diff --git a/weed/mount/weedfs_attr.go b/weed/mount/weedfs_attr.go
index 4042ce8f1..9f995608c 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 6c06e1947..9e19c8b54 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 29a13690b..8fb7c73b4 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 44477d765..eb8169d70 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,