On Fri, Aug 23, 2024 at 09:39:44AM +0100, John Garry wrote: > On 22/08/2024 21:38, Darrick J. Wong wrote: > > > > This (atomicwrites && !forcealign) ought to be checked in the superblock > > > > verifier. > > > You mean in xfs_fs_validate_params(), right? > > xfs_validate_sb_common, where we do all the other ondisk superblock > > validation. > > I don't see any other xfs_has_XXX checks in xfs_validate_sb_common(), but > this could be the first... The superblock verifier runs at a lower level in the filesystem -- it checks that the ondisk superblock doesn't contain any inconsistent fields or impossible feature combinations, etc. Once the ondisk superblock is verified, the information there is used to set XFS_FEAT_* bits in m_features, which is what the xfs_has_* predicates access. Therefore, you have to look at the raw superblock fields, not the xfs_has_ predicates: if ((sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_ATOMICWRITES) && !(sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FORCEALIGN)) { xfs_warn(mp, "atomic writes feature requires force align feature."); return -EINVAL; } The reason for checking this state here is that atomicwrites absolutely requires forcealign and that dependency will always be true. > The only other place in which I see a pattern of similar SB feature flag > checks is in xfs_finish_flags() for checking xfs_has_crc() && > xfs_has_noattr2(). > > So if we go with xfs_validate_sb_common(), then should the check in > xfs_fs_fill_super() for xfs_has_forcealign() && xfs_has_realtime()/reflink() > be relocated to xfs_validate_sb_common() also: No. Contrast the above with (forcealign && !realtime), which at least in theory is temporary, so that should live in xfs_fs_fill_super. Or put another way, xfs_fs_fill_super is where we screen out the kernel being too stupid to support something it found on disk. --D > > https://lore.kernel.org/linux-xfs/20240813163638.3751939-8-john.g.garry@xxxxxxxxxx/ > > Cheers, > John >