Skip to content

Commit

Permalink
Fix ReadDir inode leak
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoanke committed Jan 12, 2024
1 parent 350ff31 commit f4079e6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/goofys.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,16 @@ func (fs *Goofys) ForgetInode(
fs.mu.Lock()
defer fs.mu.Unlock()

if inode.isDir() && len(inode.dir.Children) != 0 {
for _, children := range inode.dir.Children {
if *children.Name == "." || *children.Name == ".." {
continue
}
delete(fs.inodes, children.Id)
fs.forgotCnt += 1
}
}

delete(fs.inodes, op.Inode)
fs.forgotCnt += 1

Expand Down

0 comments on commit f4079e6

Please sign in to comment.