xfs: lock the healthmon when inserting unmount event

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: 25ca57fa36 ("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>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Darrick J. Wong 2026-08-26 22:32:28 -07:00 committed by Carlos Maiolino
parent 9dd6cc92a7
commit 7538ba528c

View File

@ -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);