Re: [RFC PATCH] namei: revalidate the symlink dentry before invoking get_link in RCU-walk
From: Christoph Hellwig
Date: Fri Nov 20 2026 - 11:24:46 EST
On Fri, Nov 20, 2026 at 02:59:42PM +0100, Christian Brauner wrote:
> This only makes the window smaller.
>
> XFS can still reinitialize the inode right after this check and while
> get() is running. Then ->get_link() operates on an inode that is being
> reset underneath it. And the !get check only catches the case where the
> that re-init already finished before we loaded ->get_link.
>
> RCU pathwalk relies on inode memory not being reused before a grace
> period has passed. XFS itself frees inodes via call_rcu() but the
> recycle path hands the same struct inode out again without waiting for
> existing RCU walkers.
>
> So that should be fixed in XFS, either by not recycling an inode in
> place while RCU walkers can still see it or by keeping i_op and the link
> state valid across a recycle.
Not recycling the inode really isn't an option, as that means there
would cause duplicate inodes in the xfs inode cache. Keeping i_op and
state in place sounds a bit more feasibly, but could be iffy as well.
The best thing would be to find a way to keep the inode alive at the VFS
level when XFS marks it reclaimable. That would be a huge an invasive
change, but it would solve this and many other problems as well.
A good reproducer for the issue would help either way.