From: "Darrick J. Wong" <djwong@kernel.org>
To: cem@kernel.org, djwong@kernel.org, hch@lst.de
Cc: stable@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: [PATCH 6/6] xfs: lock the healthmon when inserting unmount event
Date: Wed, 26 Aug 2026 22:32:28 -0700 [thread overview]
Message-ID: <178780640303.3528187.4785802682222873330.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <178780640140.3528187.6786220801490019229.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
LOLLM complains that xfs_healthmon_unmount does an unlocked insert of
the unmount event into the health monitor's event list. Fix that.
Cc: <stable@vger.kernel.org> # v7.0
Fixes: 25ca57fa3624ca ("xfs: convey filesystem unmount events to the health monitor")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_healthmon.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
index 4521ffdab9f1ae..3ae5f4496ad1aa 100644
--- a/fs/xfs/xfs_healthmon.c
+++ b/fs/xfs/xfs_healthmon.c
@@ -272,6 +272,8 @@ __xfs_healthmon_insert(
{
struct timespec64 now;
+ lockdep_assert_held(&hm->lock);
+
ktime_get_coarse_real_ts64(&now);
event->time_ns = (now.tv_sec * NSEC_PER_SEC) + now.tv_nsec;
@@ -294,6 +296,8 @@ __xfs_healthmon_push(
{
struct timespec64 now;
+ lockdep_assert_held(&hm->lock);
+
ktime_get_coarse_real_ts64(&now);
event->time_ns = (now.tv_sec * NSEC_PER_SEC) + now.tv_nsec;
@@ -415,8 +419,10 @@ xfs_healthmon_unmount(
* There's nothing actionable for userspace after an unmount. Once
* we've inserted the unmount event, hm no longer owns that event.
*/
+ mutex_lock(&hm->lock);
__xfs_healthmon_insert(hm, hm->unmount_event);
hm->unmount_event = NULL;
+ mutex_unlock(&hm->lock);
xfs_healthmon_detach(hm);
xfs_healthmon_put(hm);
next prev parent reply other threads:[~2026-08-27 5:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 5:30 [PATCHSET v2 1/2] xfs: LLM-inspired bug fixes, part 7 Darrick J. Wong
2026-08-27 5:31 ` [PATCH 1/6] xfs: don't spin forever on zero-length dirents when salvaging them Darrick J. Wong
2026-08-27 5:31 ` [PATCH 2/6] xfs: don't stash removename operations with unknown ftype Darrick J. Wong
2026-08-27 5:31 ` [PATCH 3/6] xfs: log the tempip after we convert it to extents format Darrick J. Wong
2026-08-27 5:31 ` [PATCH 4/6] xfs: fix parent rec lookup initialization in xrep_metapath_unlink Darrick J. Wong
2026-08-27 5:32 ` [PATCH 5/6] xfs: handle reconnecting metadir subdirectories Darrick J. Wong
2026-08-27 9:23 ` Anuj Gupta
2026-08-27 14:46 ` Darrick J. Wong
2026-08-27 16:41 ` Anuj gupta
2026-08-31 6:54 ` Christoph Hellwig
2026-08-27 5:32 ` Darrick J. Wong [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-08-25 5:34 [PATCHSET 1/2] xfs: LLM-inspired bug fixes, part 7 Darrick J. Wong
2026-08-25 5:35 ` [PATCH 6/6] xfs: lock the healthmon when inserting unmount event Darrick J. Wong
2026-08-25 6:33 ` Christoph Hellwig
2026-08-25 18:17 ` Darrick J. Wong
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=178780640303.3528187.4785802682222873330.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
--cc=stable@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