]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_repair: refactor attr root block pointer check
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 27 Feb 2020 19:22:19 +0000 (14:22 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 27 Feb 2020 19:22:19 +0000 (14:22 -0500)
In process_longform_attr, replace the agcount check with a call to the
fsblock verification function in libxfs.  Now we can also catch blocks
that point to static FS metadata.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
[sandeen: update error message]
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/attr_repair.c

index 9a44f61042df4d683a6c9506e8e99fb4353c3eec..c038a5a34ddc815e1d18f3c86cdc12ed1cd5277b 100644 (file)
@@ -980,21 +980,21 @@ process_longform_attr(
        *repair = 0;
 
        bno = blkmap_get(blkmap, 0);
-
-       if ( bno == NULLFSBLOCK ) {
+       if (bno == NULLFSBLOCK) {
                if (dip->di_aformat == XFS_DINODE_FMT_EXTENTS &&
                                be16_to_cpu(dip->di_anextents) == 0)
                        return(0); /* the kernel can handle this state */
                do_warn(
        _("block 0 of inode %" PRIu64 " attribute fork is missing\n"),
                        ino);
-               return(1);
+               return 1;
        }
+
        /* FIX FOR bug 653709 -- EKN */
-       if (mp->m_sb.sb_agcount < XFS_FSB_TO_AGNO(mp, bno)) {
+       if (!xfs_verify_fsbno(mp, bno)) {
                do_warn(
-       _("agno of attribute fork of inode %" PRIu64 " out of regular partition\n"), ino);
-               return(1);
+       _("block in attribute fork of inode %" PRIu64 " is not valid\n"), ino);
+               return 1;
        }
 
        bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno),