From: Christoph Hellwig <hch@infradead.org>
To: Mikhail Lobanov <m.lobanov@rosa.ru>
Cc: cem@kernel.org, djwong@kernel.org, david@fromorbit.com,
hch@infradead.org, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: Re: [PATCH v4 1/2] xfs: skip inode inactivation on a shut down mount
Date: Wed, 10 Jun 2026 05:12:57 -0700 [thread overview]
Message-ID: <ailUyXryJh3gFZJR@infradead.org> (raw)
In-Reply-To: <20260607183026.37700-1-m.lobanov@rosa.ru>
On Sun, Jun 07, 2026 at 09:30:25PM +0300, Mikhail Lobanov wrote:
> v4: brace both branches of the if/else. Without CONFIG_XFS_QUOTA
> xfs_qm_dqdetach() expands to nothing, leaving the else with an empty
> body, which trips -Wempty-body on a W=1 build (i386-allnoconfig,
> reported by the kernel test robot).
We should really turn these stubs from macros into inlines, but..
> @@ -1940,10 +1940,26 @@ static int
> xfs_inodegc_inactivate(
> struct xfs_inode *ip)
> {
> - int error;
> + int error = 0;
>
> trace_xfs_inode_inactivating(ip);
> - error = xfs_inactive(ip);
> +
> + /*
> + * If the filesystem has been shut down - for example a mount that
> + * failed after background inactivation was enabled - do not
> + * inactivate the inode. Inactivation modifies persistent metadata,
> + * its transactions cannot complete on a shut down mount, and the
> + * subsystems it relies on (e.g. quota, mp->m_quotainfo) may not be
> + * set up. Drop any attached dquots and make the inode reclaimable,
> + * the same way xfs_inode_mark_reclaimable() does when it sends an
> + * inode straight to reclaim.
> + */
> + if (!xfs_is_shutdown(ip->i_mount)) {
> + error = xfs_inactive(ip);
> + } else {
> + /* Going straight to reclaim, so drop the dquots. */
> + xfs_qm_dqdetach(ip);
> + }
It might be easier to just move the shutdown check and xfs_qm_dqdetach
cal into the beginning of xfs_inactive as:
if (xfs_is_shutdown(mp)
goto out;
after initializing mp at declaration time at the top of the function.
But this is also still missing my other comment: xfs_qm_dqdetach
will still cause a NULL pointer dereference if quotas haven't been
set up yet or torn down already. So we'll probably want another
patch to exist early in xfs_qm_dqdetach for that case.
next prev parent reply other threads:[~2026-06-10 12:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 18:30 [PATCH v4 1/2] xfs: skip inode inactivation on a shut down mount Mikhail Lobanov
2026-06-07 18:30 ` [PATCH v4 2/2] xfs: shut down the filesystem on a failed mount Mikhail Lobanov
2026-06-10 12:13 ` Christoph Hellwig
2026-06-10 12:12 ` Christoph Hellwig [this message]
2026-06-10 19:25 ` [PATCH v4 1/2] xfs: skip inode inactivation on a shut down mount Mikhail Lobanov
2026-06-11 13:59 ` 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=ailUyXryJh3gFZJR@infradead.org \
--to=hch@infradead.org \
--cc=cem@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=m.lobanov@rosa.ru \
/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