diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-07-24 10:13:45 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-07-24 10:13:45 -0700 |
| commit | d40de39e7556d0301d4e3326e7b09d08b18ff9af (patch) | |
| tree | 867e663ec07a979cde30f7a9fb15b242ffdfce82 | |
| parent | 8dfeba80233c49f5eaea51c5143ad9ac268613b0 (diff) | |
| download | seaweedfs-d40de39e7556d0301d4e3326e7b09d08b18ff9af.tar.xz seaweedfs-d40de39e7556d0301d4e3326e7b09d08b18ff9af.zip | |
FUSE: do not change crtime, uid, gid on save
| -rw-r--r-- | weed/filesys/filehandle.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 21f86f6b5..ca35bfd02 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -191,14 +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 - if req.Uid != 0 { + if fh.f.entry.Attributes.Uid == 0 { fh.f.entry.Attributes.Uid = req.Uid } - if req.Gid != 0 { + 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 |
