Re: [PATCH] fs: only assert on LOOKUP_RCU when built with CONFIG_DEBUG_VFS

From: Jan Kara

Date: Mon Jan 05 2026 - 12:18:58 EST


On Mon 29-12-25 13:57:51, Mateusz Guzik wrote:
> Calls to the 2 modified routines are explicitly gated with checks for
> the flag, so there is no use for this in production kernels.
>
> Signed-off-by: Mateusz Guzik <mjguzik@xxxxxxxxx>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Honza

> ---
> fs/namei.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index f7a8b5b000c2..9c5a372a86f6 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -879,7 +879,7 @@ static bool try_to_unlazy(struct nameidata *nd)
> {
> struct dentry *parent = nd->path.dentry;
>
> - BUG_ON(!(nd->flags & LOOKUP_RCU));
> + VFS_BUG_ON(!(nd->flags & LOOKUP_RCU));
>
> if (unlikely(nd->flags & LOOKUP_CACHED)) {
> drop_links(nd);
> @@ -919,7 +919,8 @@ static bool try_to_unlazy(struct nameidata *nd)
> static bool try_to_unlazy_next(struct nameidata *nd, struct dentry *dentry)
> {
> int res;
> - BUG_ON(!(nd->flags & LOOKUP_RCU));
> +
> + VFS_BUG_ON(!(nd->flags & LOOKUP_RCU));
>
> if (unlikely(nd->flags & LOOKUP_CACHED)) {
> drop_links(nd);
> --
> 2.48.1
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR