]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_scrub: report truncated devices as media errors
authorDarrick J. Wong <djwong@kernel.org>
Tue, 17 Mar 2026 16:23:50 +0000 (09:23 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 9 Apr 2026 22:30:18 +0000 (15:30 -0700)
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: <linux-xfs@vger.kernel.org> # v6.13.0
Fixes: a6e089903f2f58 ("xfs_scrub: tread zero-length read verify as an IO error")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/phase6.c

index abf6f9713f1a4d71f8df803d49622da1c1eb01e1..590e5d23e6b267c671651a811bc96d288862cdf7 100644 (file)
@@ -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. */