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.

mount: remove files that may still are open

Chris Lu4609644658c8
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go
index 7c0a2b0e26..d29bc9b90b 100644
--- a/weed/filesys/dir.go
+++ b/weed/filesys/dir.go
@@ -364,6 +364,12 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)
dir.wfs.fsNodeCache.DeleteFsNode(filePath)
+ // remove current file handle if any
+ dir.wfs.handlesLock.Lock()
+ defer dir.wfs.handlesLock.Unlock()
+ inodeId := util.NewFullPath(dir.FullPath(), req.Name).AsInode()
+ delete(dir.wfs.handles, inodeId)
+
// delete the chunks last
if isDeleteData {
dir.wfs.deleteFileChunks(entry.Chunks)