[PATCH 1/5] xfs: always set xfs_healthmon::first_event when inserting at front of list

"Darrick J. Wong" <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-xfs
Message-ID <178760941102.944364.11828316232110118627.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <[email protected]>

LOLLM complains that __xfs_healthmon_insert purports to insert a
xfs_healthmon_event event at the start of the event list, but neglects
to update first_event to point to the unmount event if there were
already events in the queue.  That results in list corruption, so let's
fix this problem.

Cc: <[email protected]> # v7.0
Fixes: b3a289a2a9397b ("xfs: create event queuing, formatting, and discovery infrastructure")
Signed-off-by: "Darrick J. Wong" <[email protected]>
Assisted-by: LOLLM # finding obvious bugs
---
 fs/xfs/xfs_healthmon.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
index d8b95af33a3e9f..166ef0d5864486 100644
--- a/fs/xfs/xfs_healthmon.c
+++ b/fs/xfs/xfs_healthmon.c
@@ -276,8 +276,7 @@ __xfs_healthmon_insert(
 	event->time_ns = (now.tv_sec * NSEC_PER_SEC) + now.tv_nsec;
 
 	event->next = hm->first_event;
-	if (!hm->first_event)
-		hm->first_event = event;
+	hm->first_event = event;
 	if (!hm->last_event)
 		hm->last_event = event;
 	xfs_healthmon_bump_events(hm);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.