]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: don't ask user to run xfs_repair for only warnings
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 9 Mar 2018 02:35:23 +0000 (20:35 -0600)
committerEric Sandeen <sandeen@redhat.com>
Fri, 9 Mar 2018 02:35:23 +0000 (20:35 -0600)
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>
scrub/phase1.c
scrub/xfs_scrub.c
scrub/xfs_scrub.h

index b856a7f508369fa1e5876cb6ac003d527447df8a..002c6425f9b116e0a6f2d63dfda77b0047052652 100644 (file)
@@ -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;
 }
index 7ab0c3ee62aa6ce630bb62d4d648c4134b0ce976..7ee02b669f1426335f1d81f83b279dbdd927cf99 100644 (file)
@@ -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);
 }
index b455747dd056589116259fbe244122812ab0cf29..aa130a73f2dcd91c3c0b9048dd0c836ca9e9caf6 100644 (file)
@@ -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];
 };