Re: [PATCH] proc: only bump parent nlink when registering directories
From: Krzysztof Wilczyński
Date: Sat Jun 13 2026 - 16:08:10 EST
Hello,
> > --- a/fs/proc/generic.c
> > +++ b/fs/proc/generic.c
> > @@ -404,7 +404,8 @@ struct proc_dir_entry *proc_register(struct proc_dir_entry *dir,
> > write_unlock(&proc_subdir_lock);
> > goto out_free_inum;
> > }
> > - dir->nlink++;
> > + if (S_ISDIR(dp->mode))
> > + dir->nlink++;
> > write_unlock(&proc_subdir_lock);
>
> nlink accounting should be folded into pde_subdir_insert/pde_erase
> probably but as minimal patch it's OK.
I will follow-up with a v2, then. Thank you for the review!
All the best,
Krzysztof