Re: [PATCH] kernfs: allocate in open before taking the active reference

From: Christian Brauner

Date: Tue Dec 01 2026 - 08:40:09 EST


On Thu, 19 Nov 2026 11:19:22 -0800, Shakeel Butt wrote:
> kernfs_fop_open() allocates the open file, its seq_file and the open
> node while holding the file's active reference. The seq_file is
> charged to the opener's memory cgroup, so in a cgroup at its limit the
> allocation reclaims. Removing the file waits for active references.
> cgroup rmdir does that with cgroup_mutex held, so every cgroup
> operation on the host waits for that reclaim. Deleting a netdev waits
> the same way with rtnl_lock held.
>
> [...]

Heh, that's in the same spirit as my procfs rework. :)

---

Applied to the vfs-7.5.kernfs branch of the vfs/vfs.git tree.
Patches in the vfs-7.5.kernfs branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.5.kernfs

[1/1] kernfs: allocate in open before taking the active reference
https://git.kernel.org/vfs/vfs/c/8900b8b7e0d8