]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: force not-so-bad bmbt blocks back through the verifier
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 2 Sep 2015 22:43:07 +0000 (08:43 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 2 Sep 2015 22:43:07 +0000 (08:43 +1000)
If during prefetch we encounter a bmbt block that fails the CRC check
due to corruption in the unused part of the block, force the buffer
back through the non-prefetch verifiers later so that the CRC is
updated.  Otherwise, the bad checksum goes unfixed and the kernel will
still flag the bmbt block as invalid.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/prefetch.c

index 1de3ec0a578dd67737fa9546bafc13df974d7a7a..32ec55ebdea9ea5ca11fe2df7cf0a88594eb765c 100644 (file)
@@ -276,6 +276,18 @@ pf_scan_lbtree(
 
        XFS_BUF_SET_PRIORITY(bp, isadir ? B_DIR_BMAP : B_BMAP);
 
+       /*
+        * If the verifier flagged a problem with the buffer, we can't trust
+        * its contents for the purposes of reading ahead.  Stop prefetching
+        * the tree and mark the buffer unchecked so that the next read of the
+        * buffer will retain the error status and be acted upon appropriately.
+        */
+       if (bp->b_error) {
+               bp->b_flags |= LIBXFS_B_UNCHECKED;
+               libxfs_putbuf(bp);
+               return 0;
+       }
+
        rc = (*func)(XFS_BUF_TO_BLOCK(bp), level - 1, isadir, args);
 
        libxfs_putbuf(bp);