]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_repair: constrain attr fork extent count
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 23:07:50 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:28 +0000 (14:06 -0700)
Don't let the attr fork extent count exceed the maximum possible value.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
repair/dinode.c

index b8f5bf4e550e282ca27eb8f3795c3204bb1b3bb3..bf93a5790877a1eb0a5c948df2ab55365ff8cdfb 100644 (file)
@@ -2050,6 +2050,7 @@ process_inode_attr_fork(
        xfs_ino_t               lino = XFS_AGINO_TO_INO(mp, agno, ino);
        struct xfs_dinode       *dino = *dinop;
        struct blkmap           *ablkmap = NULL;
+       xfs_extnum_t            max_nex;
        int                     repair = 0;
        int                     err;
        int                     try_rebuild = -1; /* don't know yet */
@@ -2071,6 +2072,11 @@ retry:
        }
 
        *anextents = xfs_dfork_attr_extents(dino);
+       max_nex = xfs_iext_max_nextents(
+                       xfs_dinode_has_large_extent_counts(dino),
+                       XFS_ATTR_FORK);
+       if (*anextents > max_nex)
+               *anextents = 1;
        if (*anextents > be64_to_cpu(dino->di_nblocks))
                *anextents = 1;