Re: KernFS: Missing IN_DELETE_SELF or IN_IGNORED inotify events

From: Tejun Heo
Date: Wed May 24 2023 - 18:10:18 EST

On Wed, May 24, 2023 at 09:53:01PM +0200, Josef Schönberger wrote:
> Hi everybody,
> I'm currently working on event listeners for cgroups for a long running
> daemon. I found that the removal of cgroups that I'm currently listening
> for produces neither an IN_DELETE_SELF nor an IN_IGNORED event; which is
> unfortunate, since I need to maintain a map from watch descriptors to
> paths, from which I would like to remove all obsolete entries.
> Since this is not the documented behaviour and since I could not find
> any material that would specify an intention behind this, I'm assuming
> that this is a bug?
> I've found that the same applies to the sysfs. Taking a look at the
> kernel code, I'd guess that the issue might be in KernFS.

Yeah, that'd be all kernfs. kernfs does have some explicit fsnotify hookups
so that kernfs users can generate custom modified events (e.g. for file) but doesn't do anything else. If the generic layer
generates events, they'd go out. If not, they won't. I can't think of a
reason why hooking up the missing events would be difficult tho. I'm pretty
bandwidth constrained these days and don't know when I'll be able to get to
it but if you wanna take a stab at it, I'd be happy to review.