mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Zhang Cen <rollkingzzc@gmail.com>
Cc: Carlos Maiolino <cem@kernel.org>,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	zerocling0077@gmail.com, 2045gemini@gmail.com
Subject: Re: [PATCH] xfs: drain inodegc before quota teardown on mount failure
Date: Tue, 19 May 2026 01:40:09 -0700	[thread overview]
Message-ID: <agwh6darf9q52za7@infradead.org> (raw)
In-Reply-To: <20260514160712.2260541-1-rollkingzzc@gmail.com>

On Fri, May 15, 2026 at 12:07:12AM +0800, Zhang Cen wrote:
> Sanitizer validation reported:

How did you run into this?  Normal xfstests under a new sanitizer?

> Fixes: ab23a7768739 ("xfs: per-cpu deferred inode inactivation queues")
> 
> Signed-off-by: Zhang Cen <rollkingzzc@gmail.com>

Nit: no empty line between the Fixes and the Signoff or other tags,
please.

> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index b24195f570cd..e8a870482d1a 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -1228,6 +1228,12 @@ xfs_mountfs(
>  	return 0;
>  
>   out_agresv:
> +	/*
> +	 * Drain ordinary inodegc before we drop per-AG reservations or tear
> +	 * down quota state.  Background inactivation can still attach dquots
> +	 * here, and dqget can still need the quota inodes.
> +	 */
> +	xfs_inodegc_flush(mp);

This looks good.

>   out_free_metadir:
>  	if (mp->m_metadirip)
>  		xfs_irele(mp->m_metadirip);
>  
>  	/*
> -	 * Inactivate all inodes that might still be in memory after a log
> -	 * intent recovery failure so that reclaim can free them.  Metadata
> -	 * inodes and the root directory shouldn't need inactivation, but the
> -	 * mount failed for some reason, so pull down all the state and flee.
> +	 * Flush inodegc before we destroy quotainfo.  This is the first drain
> +	 * for paths that bypass out_agresv, and it also catches any reclaim
> +	 * queued by the quota, realtime, root, or metadir teardown above.
>  	 */
>  	xfs_inodegc_flush(mp);
>  
> +	/* Clean out dquots that might be in memory after quotacheck. */
> +	xfs_qm_unmount(mp);

This is later in the teardown order than where I'd expect it. The
first thing that can bring in quotainodes is xfs_qm_newmount.  I'd
expect a new label placed above out_rtunmount to handle this.  Is
there a reason I'm missing why this won't work?


  reply	other threads:[~2026-05-19  8:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 16:07 Zhang Cen
2026-05-19  8:40 ` Christoph Hellwig [this message]
2026-05-28  5:31   ` Zhang Cen
2026-05-28  8:32     ` Christoph Hellwig
2026-05-28 13:28       ` Cen Zhang
2026-06-02  7:01         ` Christoph Hellwig

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=agwh6darf9q52za7@infradead.org \
    --to=hch@infradead.org \
    --cc=2045gemini@gmail.com \
    --cc=cem@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=rollkingzzc@gmail.com \
    --cc=zerocling0077@gmail.com \
    /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

Powered by JetHome