summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/parent.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/scrub/parent.c')
-rw-r--r--fs/xfs/scrub/parent.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/scrub/parent.c b/fs/xfs/scrub/parent.c
index 5ff6e8327c32..62b1e5108f11 100644
--- a/fs/xfs/scrub/parent.c
+++ b/fs/xfs/scrub/parent.c
@@ -24,6 +24,22 @@ xchk_setup_parent(
struct xfs_scrub *sc,
struct xfs_inode *ip)
{
+ int error;
+
+ /*
+ * If we're attempting a repair having failed a previous repair due to
+ * being unable to lock an inode (TRY_HARDER), we need to freeze the
+ * filesystem to make the repair happen. Note that we don't bother
+ * with the fs freeze when TRY_HARDER is set but IFLAG_REPAIR isn't,
+ * because a plain scrub is allowed to return with INCOMPLETE set.
+ */
+ if ((sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) &&
+ (sc->flags & XCHK_TRY_HARDER)) {
+ error = xchk_fs_freeze(sc);
+ if (error)
+ return error;
+ }
+
return xchk_setup_inode_contents(sc, ip, 0);
}