mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Christian Brauner <brauner@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>
Subject: Re: How to detect inode leaks?
Date: Thu, 5 Nov 2026 11:30:12 -0500	[thread overview]
Message-ID: <20261105113012.5c8d8e36@gandalf.local.home> (raw)
In-Reply-To: <20261105-lesbar-puzzeln-duett-fc7bee207796@brauner>

On Thu, 5 Nov 2026 16:58:28 +0100
Christian Brauner <brauner@kernel.org> wrote:

> 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.

Thanks for the update. So leaked inodes are caught as long as the
fill_super isn't buggy ;-)

-- Steve

      reply	other threads:[~2026-11-05 16:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 20:12 Steven Rostedt
2026-11-05 15:58 ` Christian Brauner
2026-11-05 16:30   ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261105113012.5c8d8e36@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®