Re: [PATCH] xfs: drain inodegc before quota teardown on mount failure

From: Christoph Hellwig

Date: Tue Jun 02 2026 - 03:10:09 EST


On Thu, May 28, 2026 at 09:28:02PM +0800, Cen Zhang wrote:
> In my local attempts, a mount-failure errortag after
> xfs_qm_mount_quotas() was not enough by itself, because ordinary test
> setup did not reliably leave an inodegc item that would enter the
> dqattach/eofblocks path during the mount-failure unwind.
>
> The draft I have locally uses two DEBUG-only errortags:
>
> - mount_fail_after_qm_mount_quotas
>
> This injects -EIO immediately after xfs_qm_mount_quotas().
>
> - force_inodegc_eofblocks
>
> This makes a regular inode released after quotacheck scanning go
> through inodegc/eofblocks cleanup, and delays that inodegc work so
> the mount-failure unwind can reach quota teardown first.

This sounds pretty useful, but I actually have a different
question:

> Workqueue: xfs-inodegc/vdc xfs_inodegc_worker
> xfs_qm_dqget_cache_lookup()
> xfs_qm_dqget_inode()
> xfs_qm_dqattach_locked()
> xfs_qm_dqattach()
> xfs_free_eofblocks()
> xfs_inactive()
> xfs_inodegc_worker()

What kind of inode do we actually get here? I guess your test
case reproduces an unclean shutdown and this processes inodes
that otherwise would have been processed on unmount?

I'm kinda tempted to just make xfs_can_free_eofblocks return false
during early mount (or rather during mount failure), as trying
to fix all the corner cases here seems like an uphill battle (
also see the sashiko review)