Re: [PATCH 2/3] kernfs: send IN_DELETE_SELF and IN_IGNORED on file deletion

T.J. Mercier
2026-02-10T22:48:29Z

On Tue, Feb 10, 2026 at 2:42 PM Tejun Heo <tj@kernel.org> wrote:
>
> On Mon, Feb 09, 2026 at 04:38:00PM -0800, T.J. Mercier wrote:
> ...
> > static void __kernfs_remove(struct kernfs_node *kn)
> > {
> > struct kernfs_node *pos, *parent;
> > @@ -1520,6 +1538,9 @@ static void __kernfs_remove(struct kernfs_node *kn)
> > struct kernfs_iattrs *ps_iattr =
> > parent ? parent->iattr : NULL;
> >
> > + if (kernfs_type(kn) == KERNFS_FILE)
>
> kernfs_type(pos)?

Oh, yes you are right. Thanks.

> > + kernfs_notify_file_deleted(pos);
> > +
> ...
> > -static void kernfs_notify_workfn(struct work_struct *work)
> > +static int fsnotify_self_event(int event)
> > +{
> > + if (event == FS_DELETE)
> > + return FS_DELETE_SELF;
> > +
> > + return event;
> > +}
> > +
> > +void kernfs_notify_workfn(struct work_struct *work)
> > {
> > struct kernfs_node *kn;
> > struct kernfs_super_info *info;
> > struct kernfs_root *root;
> > u32 notify_event;
> > + u32 self_event;
> > repeat:
> > /* pop one off the notify_list */
> > spin_lock_irq(&kernfs_notify_lock);
> > @@ -929,6 +938,8 @@ static void kernfs_notify_workfn(struct work_struct *work)
> > kn->attr.notify_event = 0;
> > spin_unlock_irq(&kernfs_notify_lock);
> >
> > + self_event = fsnotify_self_event(notify_event);
>
> Maybe just inline the conversion?

Sure, sgtm. I figured the named function was a bit more
self-documenting, but it's just as easy to add checks for FS_DELETE
where self_event is used.

> Thanks.

>
> --
> tejun