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
fix possible error when reusing file handles
Chris Lu11b0a9cb76b0
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.goindex cc2c070eb5..b15aa68d9f 100644--- a/weed/filesys/filehandle.go+++ b/weed/filesys/filehandle.go@@ -163,7 +163,7 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) errglog.V(4).Infof("%v release fh %d", fh.f.fullpath(), fh.handle)- fh.f.wfs.ReleaseHandle(fuse.HandleID(fh.handle))+ fh.f.wfs.ReleaseHandle(fh.f.fullpath(), fuse.HandleID(fh.handle))fh.f.isOpen = falsediff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.goindex 8103fd5709..4520f2eb57 100644--- a/weed/filesys/wfs.go+++ b/weed/filesys/wfs.go@@ -99,11 +99,12 @@ func (wfs *WFS) AcquireHandle(file *File, uid, gid uint32) (fileHandle *FileHandreturn}-func (wfs *WFS) ReleaseHandle(handleId fuse.HandleID) {+func (wfs *WFS) ReleaseHandle(fullpath string, handleId fuse.HandleID) {wfs.pathToHandleLock.Lock()defer wfs.pathToHandleLock.Unlock()- glog.V(4).Infoln("releasing handle id", handleId, "current handles lengh", len(wfs.handles))+ glog.V(4).Infof("%s releasing handle id %dcurrent handles lengh %d", fullpath, handleId, len(wfs.handles))+ delete(wfs.pathToHandleIndex, fullpath)if int(handleId) < len(wfs.handles) {wfs.handles[int(handleId)] = nil}