[lvc-project] [PATCH v4 1/2] xfs: skip inode inactivation on a shut down mount

Mikhail Lobanov m.lobanov at rosa.ru
Wed Jun 10 22:25:38 MSK 2026


Hi Christoph,

> we'll probably want another patch to exit early in xfs_qm_dqdetach for
> that case

Before I send that, I went looking for a path that actually reaches it and
couldn't find one in the current tree - so I wanted to check whether you
had a specific case in mind or meant it as hardening.

xfs_qm_dqdetach() only touches the quota subsystem (the final
xfs_qm_dqrele() puts the dquot back on qi->qi_lru) when a dquot is actually
attached, and a dquot can only be attached if m_quotainfo was non-NULL at
attach time.  That leaves two windows:

  - Before setup (failed/partial mount): m_quotainfo is NULL the whole
    time, so nothing ever attaches a dquot - the existing "no dquots
    attached" early return covers it.  (That's the window the v5 series
    fixes, but it faults in dqattach, not dqdetach.)

  - After teardown: every site that frees m_quotainfo reaches it only once
    the attached dquots are already gone - unmount detaches the quota
    inodes and reclaims the rest before xfs_qm_destroy_quotainfo(), and the
    quotacheck-failure path flushes inodegc before dqpurge (0c7273e494dd).
    Runtime quota off doesn't free m_quotainfo at all.

So I don't see a reachable NULL deref today.  I'm happy to still send the
guard as belt-and-suspenders - an early "if (!ip->i_mount->m_quotainfo)
return;", symmetric with the attach-side quota checks, with no Fixes: tag
since there's no regression to point at - if you'd like it for robustness.
Or if you have a path in mind that I've missed, point me at it and I'll fix
the actual teardown ordering instead.

Thanks,
Mikhail



More information about the lvc-project mailing list