Browse Source

FUSE: skip changing to empty uid and gid during flush

Skip uid and gid changes if request uid and gid are zero

mongodb lock file, and many interim files, has empty uid and gid

I0724 10:05:51 93643 filehandle.go:173] /db/diagnostic.data/metrics.interim fh 1333342842031408359 flush Flush [ID=0x3 Node=0x50 Uid=0 Gid=0 Pid=178] 0x10 fl=0x0 lk=0x0
pull/1402/head
Chris Lu 4 years ago
parent
commit
8dfeba8023
  1. 8
      weed/filesys/filehandle.go

8
weed/filesys/filehandle.go

@ -191,8 +191,12 @@ 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 req.Uid != 0 {
fh.f.entry.Attributes.Uid = req.Uid
}
if req.Gid != 0 {
fh.f.entry.Attributes.Gid = req.Gid
}
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)

Loading…
Cancel
Save