xfs: don't complain about unfixed metadata when repairs were injected
authorDarrick J. Wong <djwong@kernel.org>
Thu, 10 Aug 2023 14:48:10 +0000 (07:48 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 10 Aug 2023 14:48:10 +0000 (07:48 -0700)
commit8336a64eb75cba4cc4749d9c4770fef53afdc1ad
treebf2ab470bd99ad8c0d989ed0a286eed338c0cc38
parentd728f4e3b21e74910e370b09bab54629eb66badb
xfs: don't complain about unfixed metadata when repairs were injected

While debugging other parts of online repair, I noticed that if someone
injects FORCE_SCRUB_REPAIR, starts an IFLAG_REPAIR scrub on a piece of
metadata, and the metadata repair fails, we'll log a message about
uncorrected errors in the filesystem.

This isn't strictly true if the scrub function didn't set OFLAG_CORRUPT
and we're only doing the repair because the error injection knob is set.
Repair functions are allowed to abort the entire operation at any point
before committing new metadata, in which case the piece of metadata is
in the same state as it was before.  Therefore, the log message should
be gated on the results of the scrub.  Refactor the predicate and
rearrange the code flow to make this happen.

Note: If the repair function errors out after it commits the new
metadata, the transaction cancellation will shut down the filesystem,
which is an obvious sign of corrupt metadata.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/scrub/common.h
fs/xfs/scrub/scrub.c