Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

FUSE: skip changing to empty uid and gid during flush

Chris Lu8dfeba80233c
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index 31fd08f975..21f86f6b5e 100644
--- a/weed/filesys/filehandle.go
+++ b/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)