Skip to content

Commit 9ea9ec8

Browse files
committed
feat(readdir): fix inode leak
kahing#786
1 parent 4225edb commit 9ea9ec8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/goofys.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,17 @@ func (fs *Goofys) ForgetInode(
764764
fs.mu.Lock()
765765
defer fs.mu.Unlock()
766766

767+
// Fix ReadDir inode leak https://github.com/kahing/goofys/pull/786
768+
if inode.isDir() {
769+
for _, child := range inode.dir.Children {
770+
if *child.Name == "." || *child.Name == ".." {
771+
continue
772+
}
773+
delete(fs.inodes, child.Id)
774+
fs.forgotCnt += 1
775+
}
776+
}
777+
767778
delete(fs.inodes, op.Inode)
768779
fs.forgotCnt += 1
769780

0 commit comments

Comments
 (0)