From: Darrick J. Wong Date: Wed, 24 Jun 2026 18:15:02 +0000 (-0700) Subject: xfs_scrub: report bad file ranges correctly X-Git-Tag: v7.1.0~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2712427c08a5ee7d24500ca93997fbabbdb43e8b;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: report bad file ranges correctly Codex complains that the "media error at data offset..." message prints the wrong information -- err_off is the offset into @map, not the file offset; and the length should be constrained by the end of @map. Fix both of these issues. Cc: linux-xfs@vger.kernel.org # v4.15.0 Fixes: b364a9c008fc04 ("xfs_scrub: scrub file data blocks") Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- diff --git a/scrub/phase6.c b/scrub/phase6.c index cd9bb26bf..2278ae5ad 100644 --- a/scrub/phase6.c +++ b/scrub/phase6.c @@ -408,6 +408,7 @@ report_ioerr_fsmap( char buf[DESCR_BUFSZ]; struct ioerr_filerange *fr = arg; uint64_t err_off; + uint64_t err_len; int ret; /* Don't care about unwritten extents. */ @@ -476,9 +477,12 @@ report_ioerr_fsmap( return 0; } + err_len = min(fr->physical + fr->length, + map->fmr_physical + map->fmr_length) - + max(fr->physical, map->fmr_physical); str_unfixable_error(ctx, buf, _("media error at data offset %llu length %llu."), - err_off, fr->length); + map->fmr_offset + err_off, err_len); return 0; }