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
refactor
chrislu94bd8b39cf8b
diff --git a/weed/mount/filehandle_map.go b/weed/mount/filehandle_map.goindex 852ef9e35d..4441de0be8 100644--- a/weed/mount/filehandle_map.go+++ b/weed/mount/filehandle_map.go@@ -1,9 +1,10 @@package mountimport (- "github.com/seaweedfs/seaweedfs/weed/util""sync"+ "github.com/seaweedfs/seaweedfs/weed/util"+"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb")@@ -67,22 +68,26 @@ func (i *FileHandleToInode) ReleaseByInode(inode uint64) {}}}+func (i *FileHandleToInode) ReleaseByHandle(fh FileHandleId) {i.Lock()defer i.Unlock()+inode, found := i.fh2inode[fh]- if found {- fhHandle, fhFound := i.inode2fh[inode]- if !fhFound {- delete(i.fh2inode, fh)- } else {- fhHandle.counter--- if fhHandle.counter <= 0 {- delete(i.inode2fh, inode)- delete(i.fh2inode, fhHandle.fh)- fhHandle.ReleaseHandle()- }- }+ if !found {+ return // Handle already released or invalid+ }++ fhHandle, fhFound := i.inode2fh[inode]+ if !fhFound {+ delete(i.fh2inode, fh)+ return+ }+ fhHandle.counter--+ if fhHandle.counter <= 0 {+ delete(i.inode2fh, inode)+ delete(i.fh2inode, fhHandle.fh)+ fhHandle.ReleaseHandle()}}