]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: check for out-of-order inobt records
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 10 Jul 2020 19:35:45 +0000 (15:35 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 10 Jul 2020 19:35:45 +0000 (15:35 -0400)
Make sure that the inode btree records are in order.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/scan.c

index 2d156d6417fdaea6ffbea25c917e0d596aaa0342..7c46ab8991aec3f21f33c8ca7fefdfd24687cf3b 100644 (file)
@@ -1947,6 +1947,7 @@ scan_inobt(
        const struct xfs_buf_ops *ops)
 {
        struct aghdr_cnts       *agcnts = priv;
+       xfs_agino_t             lastino = 0;
        int                     i;
        int                     numrecs;
        int                     state;
@@ -2029,7 +2030,16 @@ _("inode btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
                 * the block.  skip processing of bogus records.
                 */
                for (i = 0; i < numrecs; i++) {
+                       xfs_agino_t     startino;
+
                        freecount = inorec_get_freecount(mp, &rp[i]);
+                       startino = be32_to_cpu(rp[i].ir_startino);
+                       if (i > 0 && startino <= lastino)
+                               do_warn(_(
+       "out-of-order ino btree record %d (%u) block %u/%u\n"),
+                                               i, startino, agno, bno);
+                       else
+                               lastino = startino + XFS_INODES_PER_CHUNK - 1;
 
                        if (magic == XFS_IBT_MAGIC ||
                            magic == XFS_IBT_CRC_MAGIC) {