From: "Jia Zhu" <zhujia.zj@bytedance.com>
To: "Jan Kara" <jack@suse.cz>
Cc: "Jia Zhu" <zhujia.zj@bytedance.com>, <amir73il@gmail.com>,
<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 0/2] fsnotify: drop SRCU across inotify event delivery
Date: Thu, 8 Oct 2026 20:02:37 +0800 [thread overview]
Message-ID: <cover.1791452174.git.zhujia.zj@bytedance.com> (raw)
We observed fsnotify teardown stalls in production. NMI backtraces
showed inotify_handle_inode_event() in memcg reclaim, and the mark
reaper, inotifywait and a systemd process were reported blocked for more
than 327 seconds.
We checked upstream and found the same issue: inotify allocates events
under fsnotify_mark_srcu, and the global mark reaper waits in
synchronize_srcu().
The production report shows multiple inotify release paths blocked
behind the global mark reaper. Because SRCU and the reaper are shared
across groups, a stalled delivery can delay other groups' close() and
exit paths.
Patch 1 pins the iterator marks and drops SRCU around inotify delivery.
It retains fanotify's pinning semantics and preserves event delivery to
a surviving inotify watch when another watch is removed. This leaves the
reclaim stall itself unchanged.
Patch 2 skips the global reaper flush when only the closing group
reference remains. As Jan noted on the earlier patch [1], this only
helps groups with no outstanding marks. It is optional and can be
dropped.
The teardown fast path was checked in QEMU with a test-only SRCU holder.
[1] https://lore.kernel.org/all/4467cbj7eivubtdwcawvr7mhrb7armgoc4xfqjjnncrbkxxag6@3mmou6nhviao/
Jia Zhu (2):
inotify: drop fsnotify SRCU protection during event delivery
fsnotify: avoid unrelated mark reaper waits during group teardown
fs/notify/fsnotify.c | 15 ++++++++++++---
fs/notify/group.c | 26 +++++++++++++++-----------
fs/notify/inotify/inotify_user.c | 3 ++-
fs/notify/mark.c | 26 ++++++++++++++++++++++----
include/linux/fsnotify_backend.h | 2 ++
5 files changed, 53 insertions(+), 19 deletions(-)
base-commit: df2908090cda368b01ff43709f51890076c56157
--
2.20.1
next reply other threads:[~2026-10-08 12:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 12:02 Jia Zhu [this message]
2026-10-08 12:02 ` [PATCH v2 1/2] inotify: drop fsnotify SRCU protection during " Jia Zhu
2026-10-08 12:02 ` [PATCH v2 2/2] fsnotify: avoid unrelated mark reaper waits during group teardown Jia Zhu
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=cover.1791452174.git.zhujia.zj@bytedance.com \
--to=zhujia.zj@bytedance.com \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®