Re: [PATCH 1/3] kernfs: activate nodes while linking them
From: Andy Shevchenko
Date: Fri Sep 11 2026 - 14:27:50 EST
On Fri, Sep 11, 2026 at 07:16:03PM +0200, Pavol Sakac wrote:
> kernfs_add_one() links a new node, releases kernfs_rwsem, and takes it
> again through kernfs_activate(). A new node has no descendants, so the
> second hold only activates that node.
>
> Activate ordinary nodes before releasing the linking hold, removing a
> second write-side acquisition and the linked-but-inactive interval.
> KERNFS_ROOT_CREATE_DEACTIVATED roots retain explicit subtree activation.
>
> Removing the unlock-to-lock pair also removes its publication ordering.
> The in-tree lockless ID lookups use CREATE_DEACTIVATED roots and retain
> kernfs_activate(); unsynchronized callers cannot rely on observing a
> node.
...
> +static void kernfs_activate_one(struct kernfs_node *kn);
> +
Can we avoid adding forward declarations like this? Or is there circular
dependencies? If not, add another patch that simply moves the existing code
upper, so this patch won't need a forward declaration.
--
With Best Regards,
Andy Shevchenko