From 55bbd63658a3e5cd038835b9ef53e6e57282b237 Mon Sep 17 00:00:00 2001 From: gaoanke Date: Thu, 11 Jan 2024 23:42:24 +0800 Subject: [PATCH] Fix ReadDir inode leak --- internal/goofys.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/goofys.go b/internal/goofys.go index 4f4bd76f..c5c83245 100644 --- a/internal/goofys.go +++ b/internal/goofys.go @@ -764,6 +764,16 @@ func (fs *Goofys) ForgetInode( fs.mu.Lock() defer fs.mu.Unlock() + if inode.isDir() { + for _, child := range inode.dir.Children { + if *child.Name == "." || *child.Name == ".." { + continue + } + delete(fs.inodes, child.Id) + fs.forgotCnt += 1 + } + } + delete(fs.inodes, op.Inode) fs.forgotCnt += 1