On Sat, Jan 08, 2022 at 03:22:03PM -0800, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > While I was auditing the code in xfs_repair that adds feature bits to > existing V5 filesystems, I decided to have a look at how online fsck > handles feature bits, and I found a few problems: > > 1) ATTR2 is added to the primary super when an xattr is set to a file, > but that isn't consistently propagated to secondary supers. This isn't > a corruption, merely a discrepancy that repair will fix if it ever has > to restore the primary from a secondary. Hence, if we find a mismatch > on a secondary, this is a preen condition, not a corruption. > > 2) There are more compat and ro_compat features now than there used to > be, but we mask off the newer features from testing. This means we > ignore inconsistencies in the INOBTCOUNT and BIGTIME features, which is > wrong. Get rid of the masking and compare directly. > > 3) NEEDSREPAIR, when set on a secondary, is ignored by everyone. Hence > a mismatch here should also be flagged for preening, and online repair > should clear the flag. Right now we ignore it due to (2). > > 4) log_incompat features are ephemeral, since we can clear the feature > bit as soon as the log no longer contains live records for a particular > log feature. As such, the only copy we care about is the one in the > primary super. If we find any bits set in the secondary super, we > should flag that for preening, and clear the bits if the user elects to > repair it. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> All looks reasonable. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx