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
FUSE: skip flushing if file is deleted
Chris Lu055374a50bc3
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.goindex 904999c43e..1af868d586 100644--- a/weed/filesys/dir.go+++ b/weed/filesys/dir.go@@ -443,7 +443,10 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {dir.wfs.handlesLock.Lock()defer dir.wfs.handlesLock.Unlock()inodeId := filePath.AsInode()- delete(dir.wfs.handles, inodeId)+ if fh, ok := dir.wfs.handles[inodeId]; ok {+ delete(dir.wfs.handles, inodeId)+ fh.isDeleted = true+ }return nildiff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.goindex 88cfe45f05..f95051f65e 100644--- a/weed/filesys/filehandle.go+++ b/weed/filesys/filehandle.go@@ -33,11 +33,12 @@ type FileHandle struct {Uid uint32 // user ID of process making requestGid uint32 // group ID of process making requestwriteOnly bool+ isDeleted bool}func newFileHandle(file *File, uid, gid uint32, writeOnly bool) *FileHandle {fh := &FileHandle{- f: file,+ f: file,// dirtyPages: newContinuousDirtyPages(file, writeOnly),dirtyPages: newTempFileDirtyPages(file, writeOnly),Uid: uid,@@ -222,6 +223,11 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {glog.V(4).Infof("Flush %v fh %d", fh.f.fullpath(), fh.handle)+ if fh.isDeleted {+ glog.V(4).Infof("Flush %v fh %d skip deleted", fh.f.fullpath(), fh.handle)+ return nil+ }+fh.Lock()defer fh.Unlock()