From 4609644658c824f7e8feb0a741b3fbc8de6da5a6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 1 Nov 2020 01:33:26 -0800 Subject: [PATCH] mount: remove files that may still are open related to https://github.com/chrislusf/seaweedfs/issues/1581 --- weed/filesys/dir.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go index 7c0a2b0e2..d29bc9b90 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)