mount2: adjust file mode

This commit is contained in:
chrislu 2022-02-18 00:47:02 -08:00
parent f9d33f70b0
commit e8ce30fdc5
4 changed files with 7 additions and 5 deletions

View file

@ -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)

View file

@ -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,

View file

@ -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()
}

View file

@ -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,