Re: How to detect inode leaks?
From: Christian Brauner
Date: Thu Nov 05 2026 - 11:23:19 EST
On Fri, Oct 30, 2026 at 04:12:20PM -0400, Steven Rostedt wrote:
> This got me thinking. If for some reason any use case of alloc_inode() did
> not free it, kmemleak will not catch it. I'm guessing because the inode is
> referenced by something somewhere (where it requires the drop_caches or
> memory pressure to free it).
>
> My question is, is there any mechanism that can catch leaked inodes?
Yeah, but it won't fire for your case. generic_shutdown_super() calls
evict_inodes() and then complains about inodes that are still on
sb->s_inodes:
if (CHECK_DATA_CORRUPTION(!list_empty(&sb->s_inodes), NULL,
"VFS: Busy inodes after unmount of %s (%s)",
sb->s_id, sb->s_type->name)) {
That's all. That whole block sits under if (sb->s_root).
Your fill_super() fails before that's set. So the superblock gets zapped
without ever looking at sb->s_inodes.