Skip to content

Commit f4079e6

Browse files
author
gaoanke
committed
Fix ReadDir inode leak
1 parent 350ff31 commit f4079e6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/goofys.go

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

767+
if inode.isDir() && len(inode.dir.Children) != 0 {
768+
for _, children := range inode.dir.Children {
769+
if *children.Name == "." || *children.Name == ".." {
770+
continue
771+
}
772+
delete(fs.inodes, children.Id)
773+
fs.forgotCnt += 1
774+
}
775+
}
776+
767777
delete(fs.inodes, op.Inode)
768778
fs.forgotCnt += 1
769779

0 commit comments

Comments
 (0)