aboutsummaryrefslogtreecommitdiffstats
path: root/scrub
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-03-08 20:35:23 -0600
committerEric Sandeen <sandeen@redhat.com>2018-03-08 20:35:23 -0600
commitc767c5aee0427c117b9338a62a5f140befd15aaa (patch)
tree96f6d5c9d642fef7c27b9de4bac13701fd216342 /scrub
parent7c309151c9ca733fd6319250abafb447cb4d5d61 (diff)
downloadxfsprogs-dev-c767c5aee0427c117b9338a62a5f140befd15aaa.tar.gz
xfs_scrub: don't ask user to run xfs_repair for only warnings
Don't advise the user to run xfs_repair on a filesystem that triggers warnings but no errors; there's no corruption for it to fix. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Diffstat (limited to 'scrub')
-rw-r--r--scrub/phase1.c2
-rw-r--r--scrub/xfs_scrub.c7
-rw-r--r--scrub/xfs_scrub.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/scrub/phase1.c b/scrub/phase1.c
index b856a7f508..002c6425f9 100644
--- a/scrub/phase1.c
+++ b/scrub/phase1.c
@@ -237,6 +237,6 @@ _("Unable to find realtime device path."));
* purely setup errors).
*/
log_info(ctx, _("Invoking online scrub."), ctx);
- ctx->need_repair = true;
+ ctx->scrub_setup_succeeded = true;
return true;
}
diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index 7ab0c3ee62..7ee02b669f 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -522,7 +522,12 @@ report_outcome(
total_errors, ctx->warnings_found);
}
- if (ctx->need_repair)
+ /*
+ * Don't advise the user to run repair unless we were successful in
+ * setting up the scrub and we actually saw corruptions. Warnings
+ * are not corruptions.
+ */
+ if (ctx->scrub_setup_succeeded && total_errors > 0)
fprintf(stderr, _("%s: Unmount and run xfs_repair.\n"),
ctx->mntpoint);
}
diff --git a/scrub/xfs_scrub.h b/scrub/xfs_scrub.h
index b455747dd0..aa130a73f2 100644
--- a/scrub/xfs_scrub.h
+++ b/scrub/xfs_scrub.h
@@ -96,7 +96,7 @@ struct scrub_ctx {
unsigned long long naming_warnings;
unsigned long long repairs;
unsigned long long preens;
- bool need_repair;
+ bool scrub_setup_succeeded;
bool preen_triggers[XFS_SCRUB_TYPE_NR];
};