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

Christoph Hellwig <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-xfs
Message-ID <[email protected]>
On Mon, Aug 24, 2026 at 10:36:12PM -0700, Darrick J. Wong wrote:
> 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.

I can't really follow this..

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

event is the newly inserted event.  We want to queue it at the
head of the list (why, btw?).  The next point in event points to
first_event (which can be NULL).  And first should always point
to event, otherwise we potentially never queue anything up?  I.e.
we never ever actually set first?  Not sure how that is related
to umount.

Maybe this should just use standard list_head-based lists even
if they waste an extra pointer in the event structure?
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.