]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_scrub: fix nonsense advice after a scrub finds errors
authorDarrick J. Wong <djwong@kernel.org>
Thu, 4 Jun 2026 06:07:27 +0000 (23:07 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Thu, 11 Jun 2026 10:26:04 +0000 (12:26 +0200)
If a user ran xfs_scrub -p (aka optimization-only mode) and it found
errors, we advise the user to run without -n.  That's silly, because
they didn't run with -n, they ran with -p.  Fix the messaging here.

Cc: linux-xfs@vger.kernel.org # v6.10.0
Fixes: 84e248f3e83f36 ("xfs_scrub: add an optimization-only mode")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
scrub/xfs_scrub.c

index 80b56f8baef6111e2b1e587a514695994c7e40c3..383aa8752b2ce74f0b626fd60165a058774ba1dd 100644 (file)
@@ -610,12 +610,20 @@ report_outcome(
         * are not corruptions.
         */
        if (ctx->scrub_setup_succeeded && actionable_errors > 0) {
-               char            *msg;
+               char            *msg = NULL;
 
-               if (ctx->mode != SCRUB_MODE_REPAIR)
+               switch (ctx->mode) {
+               case SCRUB_MODE_DRY_RUN:
                        msg = _("%s: Re-run xfs_scrub without -n.\n");
-               else
+                       break;
+               case SCRUB_MODE_PREEN:
+                       msg = _("%s: Re-run xfs_scrub without -p.\n");
+                       break;
+               case SCRUB_MODE_NONE:
+               case SCRUB_MODE_REPAIR:
                        msg = _("%s: Unmount and run xfs_repair.\n");
+                       break;
+               }
 
                fprintf(stderr, msg, ctx->mntpoint);
        }