xfs: allow the user to cancel repairs before we start writing
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)
commitd728f4e3b21e74910e370b09bab54629eb66badb
tree7f939a932324d6828908c3d2fc26cd2a1d9a52a7
parentd65eb8a63350d9344611567607d3b59dccb7e76e
xfs: allow the user to cancel repairs before we start writing

All online repair functions have the same structure: walk filesystem
metadata structures gathering enough data to rebuild the structure,
stage a new copy, and then commit the new copy.

The gathering steps do not write anything to disk, so they are peppered
with xchk_should_terminate calls to avoid softlockup warnings and to
provide an opportunity to abort the repair (by killing xfs_scrub).
However, it's not clear in the code base when is the last chance to
abort cleanly without having to undo a bunch of structure.

Therefore, add one more call to xchk_should_terminate (along with a
comment) providing the sysadmin with the ability to abort before it's
too late and to make it clear in the source code when it's no longer
convenient or safe to abort a repair.   As there are only four repair
functions right now, this patch exists more to establish a precedent for
subsequent additions than to deliver practical functionality.

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