aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Maiolino <cem@kernel.org>2024-01-23 11:28:50 +0100
committerCarlos Maiolino <cem@kernel.org>2024-01-23 11:28:50 +0100
commit0f7e58a387f57ebda2566916b545077f51dc2da1 (patch)
tree376fd4af9ae6fdc7312cd6b5f2c9d0b37e81b012
parent813262c781cb976f8dfba7a7b5a3e1abedc6d837 (diff)
parent96ac83c88e01ff7f59563ff76a96e555477c8637 (diff)
downloadxfsprogs-dev-0f7e58a387f57ebda2566916b545077f51dc2da1.tar.gz
Merge tag 'scrub-repair-fixes-6.6_2024-01-11' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfsprogs-dev into for-next
xfs_scrub: fixes to the repair code [v28.3 3/6] Now that we've landed the new kernel code, it's time to reorganize the xfs_scrub code that handles repairs. Clean up various naming warts and misleading error messages. Move the repair code to scrub/repair.c as the first step. Then, fix various issues in the repair code before we start reorganizing things. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r--scrub/phase6.c13
-rw-r--r--scrub/xfs_scrub.c2
2 files changed, 14 insertions, 1 deletions
diff --git a/scrub/phase6.c b/scrub/phase6.c
index 33c3c8bde3..99a32bc796 100644
--- a/scrub/phase6.c
+++ b/scrub/phase6.c
@@ -397,7 +397,18 @@ report_ioerr_fsmap(
snprintf(buf, DESCR_BUFSZ, _("disk offset %"PRIu64),
(uint64_t)map->fmr_physical + err_off);
type = decode_special_owner(map->fmr_owner);
- str_corrupt(ctx, buf, _("media error in %s."), type);
+ /*
+ * On filesystems that don't store reverse mappings, the
+ * GETFSMAP call returns OWNER_UNKNOWN for allocated space.
+ * We'll have to let the directory tree walker find the file
+ * that lost data.
+ */
+ if (!(ctx->mnt.fsgeom.flags & XFS_FSOP_GEOM_FLAGS_RMAPBT) &&
+ map->fmr_owner == XFS_FMR_OWN_UNKNOWN) {
+ str_info(ctx, buf, _("media error detected."));
+ } else {
+ str_corrupt(ctx, buf, _("media error in %s."), type);
+ }
}
/* Report extent maps */
diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index a1b6754439..752180d646 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -535,6 +535,7 @@ _("%s: repairs made: %llu.\n"),
fprintf(stdout,
_("%s: optimizations made: %llu.\n"),
ctx->mntpoint, ctx->preens);
+ fflush(stdout);
}
static void
@@ -620,6 +621,7 @@ main(
int error;
fprintf(stdout, "EXPERIMENTAL xfs_scrub program in use! Use at your own risk!\n");
+ fflush(stdout);
progname = basename(argv[0]);
setlocale(LC_ALL, "");