]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: allow inodes with zero extents but nonzero nblocks
authorDarrick J. Wong <djwong@kernel.org>
Wed, 3 Jul 2024 21:22:18 +0000 (14:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 16 Jul 2024 22:49:19 +0000 (15:49 -0700)
Metadata inodes that store btrees will have zero extents and a nonzero
nblocks.  Adjust the inode verifier so that this combination is not
flagged.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/xfs_inode_buf.c

index 23222b1b05c764a2a9c5fc293e0abb6cbe6744ae..2ffb3174e9d8b02fc822665608e3bcffa7a9d112 100644 (file)
@@ -631,9 +631,6 @@ xfs_dinode_verify(
        if (mode && nextents + naextents > nblocks)
                return __this_address;
 
-       if (nextents + naextents == 0 && nblocks != 0)
-               return __this_address;
-
        if (S_ISDIR(mode) && nextents > mp->m_dir_geo->max_extents)
                return __this_address;
 
@@ -737,6 +734,19 @@ xfs_dinode_verify(
                        return fa;
        }
 
+       /* metadata inodes containing btrees always have zero extent count */
+       if (flags2 & XFS_DIFLAG2_METADIR) {
+               switch (XFS_DFORK_FORMAT(dip, XFS_DATA_FORK)) {
+               case XFS_DINODE_FMT_RMAP:
+                       break;
+               default:
+                       if (nextents + naextents == 0 && nblocks != 0)
+                               return __this_address;
+                       break;
+               }
+       } else if (nextents + naextents == 0 && nblocks != 0)
+               return __this_address;
+
        return NULL;
 }