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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
do not read attributes when file is opened
Chris Luac66c133a5a5
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.goindex 5e9ede79db..ba9f84654a 100644--- a/weed/filesys/dir.go+++ b/weed/filesys/dir.go@@ -120,6 +120,7 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,if err == nil {file := dir.newFile(req.Name, nil)dir.NodeMap[req.Name] = file+ file.isOpen = truereturn file, &FileHandle{f: file,RequestId: req.Header.ID,diff --git a/weed/filesys/file.go b/weed/filesys/file.goindex 09ae4c871e..d63f9d62d0 100644--- a/weed/filesys/file.go+++ b/weed/filesys/file.go@@ -23,13 +23,14 @@ type File struct {dir *Dirwfs *WFSattributes *filer_pb.FuseAttributes+ isOpen bool}func (file *File) Attr(context context.Context, attr *fuse.Attr) error {fullPath := filepath.Join(file.dir.Path, file.Name)- if file.attributes == nil {+ if file.attributes == nil || !file.isOpen {item := file.wfs.listDirectoryEntriesCache.Get(fullPath)if item != nil {entry := item.Value().(*filer_pb.Entry)@@ -80,6 +81,8 @@ func (file *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.Opglog.V(3).Infof("%v file open %+v", fullPath, req)+ file.isOpen = true+return &FileHandle{f: file,RequestId: req.Header.ID,diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.goindex 414057f4ef..d9dc6795e2 100644--- a/weed/filesys/filehandle.go+++ b/weed/filesys/filehandle.go@@ -184,6 +184,8 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) errglog.V(3).Infof("%+v/%v release fh", fh.f.dir.Path, fh.f.Name)+ fh.f.isOpen = false+return nil}