aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/filehandle.go
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2020-07-28 00:50:50 +0800
committerGitHub <noreply@github.com>2020-07-28 00:50:50 +0800
commitf9ba5cd9860dfda244bf2a734d690b64966e8210 (patch)
tree3cab28e6fb5134050963fcf33167e701b76a6f26 /weed/filesys/filehandle.go
parent437d18705dea48d78c066d526c14c8abcdb1405f (diff)
parent37e964d4bd60a9dd792a9cc24f05eaa05d3766f2 (diff)
downloadseaweedfs-f9ba5cd9860dfda244bf2a734d690b64966e8210.tar.xz
seaweedfs-f9ba5cd9860dfda244bf2a734d690b64966e8210.zip
Merge pull request #5 from chrislusf/master
sync
Diffstat (limited to 'weed/filesys/filehandle.go')
-rw-r--r--weed/filesys/filehandle.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index 31fd08f97..ca35bfd02 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -191,10 +191,16 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
if fh.f.entry.Attributes != nil {
fh.f.entry.Attributes.Mime = fh.contentType
- fh.f.entry.Attributes.Uid = req.Uid
- fh.f.entry.Attributes.Gid = req.Gid
+ if fh.f.entry.Attributes.Uid == 0 {
+ fh.f.entry.Attributes.Uid = req.Uid
+ }
+ if fh.f.entry.Attributes.Gid == 0 {
+ fh.f.entry.Attributes.Gid = req.Gid
+ }
+ if fh.f.entry.Attributes.Crtime == 0 {
+ fh.f.entry.Attributes.Crtime = time.Now().Unix()
+ }
fh.f.entry.Attributes.Mtime = time.Now().Unix()
- fh.f.entry.Attributes.Crtime = time.Now().Unix()
fh.f.entry.Attributes.FileMode = uint32(os.FileMode(fh.f.entry.Attributes.FileMode) &^ fh.f.wfs.option.Umask)
fh.f.entry.Attributes.Collection = fh.dirtyPages.collection
fh.f.entry.Attributes.Replication = fh.dirtyPages.replication