]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_repair: fix clearing of quota CHKD flags
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 30 Jul 2020 00:15:27 +0000 (20:15 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 30 Jul 2020 00:15:27 +0000 (20:15 -0400)
commitcfaac8d975790aad84a245a5536de0791af4c52c
tree2e945e512919f0d7618b90dfb8a3f9b2741c53dc
parent4ff36b068731f129c5a1fae93e10d6a54d39e46d
xfs_repair: fix clearing of quota CHKD flags

XFS_ALL_QUOTA_CHKD, being a OR of [UGP]QUOTA_CHKD, is a bitset of the
possible *incore* quota checked flags.  This means that it cannot be
used in a comparison with the *ondisk* quota checked flags because V4
filesystems set OQUOTA_CHKD, not the [GU]QUOTA_CHKD flags (which are V5
flags).

If you have a V4 filesystem with user quotas disabled but either group
or project quotas enabled, xfs_repair will /not/ claim that the quota
info will be regenerated on the next mount like it does in any other
situation.  This is because the ondisk qflags field has OQUOTA_CHKD set
but repair fails to notice.

Worse, if you have a V4 filesystem with user and group quotas enabled
and mild corruption, repair will claim that the quota info will be
regenerated.  If you then mount the fs with only group quotas enabled,
quotacheck will not run to correct the data because repair failed to
clear OQUOTA_CHKD properly.

These are fairly benign and unlikely scenarios, but when we add
quotacheck capabilities to xfs_repair, it will complain about the
incorrect quota counts, which causes regressions in xfs/278.

Fixes: 342aef1ec0ec ("xfsprogs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/xfs_repair.c