@@ -31,6 +31,25 @@ struct scan_ctl {
bool aborted;
};
+/* Warn about the types of mutual inconsistencies that may make repairs hard. */
+static inline void
+warn_repair_difficulties(
+ struct scrub_ctx *ctx,
+ unsigned int difficulty,
+ const char *descr)
+{
+ if (!(difficulty & REPAIR_DIFFICULTY_SECONDARY))
+ return;
+ if (debug_tweak_on("XFS_SCRUB_FORCE_REPAIR"))
+ return;
+
+ if (difficulty & REPAIR_DIFFICULTY_PRIMARY)
+ str_info(ctx, descr, _("Corrupt primary and secondary metadata."));
+ else
+ str_info(ctx, descr, _("Corrupt secondary metadata."));
+ str_info(ctx, descr, _("Filesystem might not be repairable."));
+}
+
/* Scrub each AG's metadata btrees. */
static void
scan_ag_metadata(
@@ -80,18 +99,7 @@ scan_ag_metadata(
*/
difficulty = action_list_difficulty(&alist);
action_list_find_mustfix(&alist, &immediate_alist);
-
- if ((difficulty & REPAIR_DIFFICULTY_SECONDARY) &&
- !debug_tweak_on("XFS_SCRUB_FORCE_REPAIR")) {
- if (difficulty & REPAIR_DIFFICULTY_PRIMARY)
- str_info(ctx, descr,
-_("Corrupt primary and secondary block mapping metadata."));
- else
- str_info(ctx, descr,
-_("Corrupt secondary block mapping metadata."));
- str_info(ctx, descr,
-_("Filesystem might not be repairable."));
- }
+ warn_repair_difficulties(ctx, difficulty, descr);
/* Repair (inode) btree damage. */
ret = action_list_process_or_defer(ctx, agno, &immediate_alist);
@@ -115,6 +123,7 @@ scan_fs_metadata(
struct action_list alist;
struct scrub_ctx *ctx = (struct scrub_ctx *)wq->wq_ctx;
struct scan_ctl *sctl = arg;
+ unsigned int difficulty;
int ret;
if (sctl->aborted)
@@ -127,6 +136,10 @@ scan_fs_metadata(
goto out;
}
+ /* Complain about metadata corruptions that might not be fixable. */
+ difficulty = action_list_difficulty(&alist);
+ warn_repair_difficulties(ctx, difficulty, xfrog_scrubbers[type].descr);
+
action_list_defer(ctx, 0, &alist);
out: