Linux filesystem development
 help / color / mirror / Atom feed
From: "Krzysztof Wilczyński" <kwilczynski@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Christian Brauner <brauner@kernel.org>,
	 Alexey Dobriyan <adobriyan@gmail.com>,
	Wei Yang <albinwyang@tencent.com>,
	 Zijie Wang <wangzijie1@honor.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] proc: only bump parent nlink when registering directories
Date: Tue, 7 Jul 2026 02:39:49 +0900	[thread overview]
Message-ID: <20260706173922.GA265195@rocinante> (raw)
In-Reply-To: <nmzpiovepu4fi2ls2xrgserszqy3vwyoud3u4ze7cz53wwjvp6@jmenhf5qni6e>

Hello,

> > > > proc_register() increments the parent directory's link count for every
> > > > entry it registers, while remove_proc_entry() and remove_proc_subtree()
> > > > decrement it only when the removed entry is a directory.  Regular files
> > > > thus inflate the parent's count while they exist, and leak one link
> > > > permanently on every create and remove cycle.
> > > > 
> > > > For example, /proc/bus/pci/00 with twenty-two device files and no
> > > > subdirectories reports nlink 24 instead of 2, and SR-IOV VF enable
> > > > and disable cycles, each creating and removing the VF config space
> > > > entries under /proc/bus/pci/<bus>, inflate the link count of that
> > > > directory without bound.
> > > > 
> > > > [...]
> > > 
> > > Applied to the vfs.fixes branch of the vfs/vfs.git tree.
> > > Patches in the vfs.fixes branch should appear in linux-next soon.
> > [...] 
> > > [1/1] proc: only bump parent nlink when registering directories
> > >       https://git.kernel.org/vfs/vfs/c/552864f6ac8f
> > 
> > I assume this got lost?  Seems its missing from 7.2-rc1, sadly.
> 
> I don't think it got lost. I'd expect Christian to send the fix for 7.2-rc2
> (he merged it to his tree only during a merge window). I've checked his
> tree to verify but apparently Christian didn't push out vfs.fixes or
> vfs.all branch for a couple of weeks.

I saw the patch landed.  Thank you for help!

All the best,

	Krzysztof

      reply	other threads:[~2026-07-06 17:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-13 21:10 [PATCH v2] proc: only bump parent nlink when registering directories Krzysztof Wilczyński
2026-06-17 13:21 ` Christian Brauner
2026-06-29  5:42   ` Krzysztof Wilczyński
2026-06-29  9:17     ` Jan Kara
2026-07-06 17:39       ` Krzysztof Wilczyński [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=20260706173922.GA265195@rocinante \
    --to=kwilczynski@kernel.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=albinwyang@tencent.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangzijie1@honor.com \
    /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