From: "T.J. Mercier" <tjmercier@google.com>
To: gregkh@linuxfoundation.org, tj@kernel.org,
driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org, shuah@kernel.org,
linux-kselftest@vger.kernel.org
Cc: "T.J. Mercier" <tjmercier@google.com>
Subject: [PATCH v2 0/3] kernfs: Add inotify IN_DELETE_SELF, IN_IGNORED support for files
Date: Thu, 12 Feb 2026 13:58:11 -0800 [thread overview]
Message-ID: <20260212215814.629709-1-tjmercier@google.com> (raw)
This series adds support for IN_DELETE_SELF and IN_IGNORED inotify
events to kernfs files.
Currently, kernfs (used by cgroup and others) supports IN_MODIFY events
but fails to notify watchers when the file is removed (e.g. during
cgroup destruction). This forces userspace monitors to maintain resource
intensive side-channels like pidfds, procfs polling, or redundant
directory watches to detect when a cgroup dies and a watched file is
removed.
By generating IN_DELETE_SELF events on destruction, we allow watchers to
rely on a single watch descriptor for the entire lifecycle of the
monitored file, reducing resource usage (file descriptors, CPU cycles)
and complexity in userspace.
The series is structured as follows:
Patch 1 refactors kernfs_elem_attr to support arbitrary event types.
Patch 2 implements the logic to generate DELETE_SELF and IGNORED events
on file removal.
Patch 3 adds selftests to verify the new behavior.
---
Changes in v2:
Remove unused variables from new selftests per kernel test robot
Fix kernfs_type argument per Tejun
Inline checks for FS_MODIFY, FS_DELETE in kernfs_notify_workfn per Tejun
T.J. Mercier (3):
kernfs: allow passing fsnotify event types
kernfs: send IN_DELETE_SELF and IN_IGNORED on file deletion
selftests: memcg: Add tests IN_DELETE_SELF and IN_IGNORED on
memory.events
fs/kernfs/dir.c | 21 +++
fs/kernfs/file.c | 20 ++-
fs/kernfs/kernfs-internal.h | 3 +
include/linux/kernfs.h | 1 +
.../selftests/cgroup/test_memcontrol.c | 122 ++++++++++++++++++
5 files changed, 161 insertions(+), 6 deletions(-)
base-commit: ba268514ea14b44570030e8ed2aef92a38679e85
--
2.53.0.273.g2a3d683680-goog
next reply other threads:[~2026-02-12 21:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 21:58 T.J. Mercier [this message]
2026-02-12 21:58 ` [PATCH v2 1/3] kernfs: allow passing fsnotify event types T.J. Mercier
2026-02-16 16:27 ` Amir Goldstein
2026-02-17 19:27 ` T.J. Mercier
2026-02-12 21:58 ` [PATCH v2 2/3] kernfs: send IN_DELETE_SELF and IN_IGNORED on file deletion T.J. Mercier
2026-02-17 10:18 ` Amir Goldstein
2026-02-17 19:25 ` T.J. Mercier
2026-02-17 21:25 ` Amir Goldstein
2026-02-17 22:32 ` T.J. Mercier
2026-02-17 23:13 ` Amir Goldstein
2026-02-18 11:23 ` Jan Kara
2026-02-12 21:58 ` [PATCH v2 3/3] selftests: memcg: Add tests IN_DELETE_SELF and IN_IGNORED on memory.events T.J. Mercier
2026-02-16 16:21 ` [PATCH v2 0/3] kernfs: Add inotify IN_DELETE_SELF, IN_IGNORED support for files Amir Goldstein
2026-02-17 19:25 ` T.J. Mercier
2026-02-17 6:43 ` Tejun Heo
2026-02-17 19:25 ` T.J. Mercier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260212215814.629709-1-tjmercier@google.com \
--to=tjmercier@google.com \
--cc=cgroups@vger.kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.