From: Darrick J. Wong Date: Tue, 17 Mar 2026 16:23:50 +0000 (-0700) Subject: xfs_scrub: report truncated devices as media errors X-Git-Tag: v7.0.0~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4e0c9692f6a88cf3320b4bb2f036b82710278c3b;p=xfsprogs-dev.git xfs_scrub: report truncated devices as media errors If we encounter a zero-length read of an xfs device but don't hit any actual media errors, we won't report the truncated device. Fix that. Also fix the mistake that flushing the verify-pools of the log/rt devices doesn't actually cause scrub to abort. Cc: # v6.13.0 Fixes: a6e089903f2f58 ("xfs_scrub: tread zero-length read verify as an IO error") Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- diff --git a/scrub/phase6.c b/scrub/phase6.c index abf6f971..590e5d23 100644 --- a/scrub/phase6.c +++ b/scrub/phase6.c @@ -782,9 +782,13 @@ phase6_func( * If the verify flush didn't work or we found no bad blocks, we're * done! No errors detected. */ - if (ret || ret2 || ret3) + if (ret || ret2 || ret3) { + ret |= ret2 | ret3; /* caller only cares about non-zero/zero */ goto out_rbad; - if (bitmap_empty(vs.d_bad) && bitmap_empty(vs.r_bad)) + } + if (bitmap_empty(vs.d_bad) && !vs.d_trunc && + bitmap_empty(vs.r_bad) && !vs.r_trunc && + !vs.l_trunc) goto out_rbad; /* Scan the whole dir tree to see what matches the bad extents. */