]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: fix AG header btree level comparisons
authorDarrick J. Wong <djwong@kernel.org>
Thu, 6 Jan 2022 22:13:21 +0000 (14:13 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 20 Jan 2022 00:02:52 +0000 (16:02 -0800)
It's not an error if repair encounters a btree with the maximal
height, so don't print warnings.  Also, we don't allow zero-height
btrees.

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

index 909c4494c24a816ba7d87832432e7e911c4e8906..e2d281a211ea3ed6cb9ea86ed3b15f97d97bc9ef 100644 (file)
@@ -2297,7 +2297,7 @@ validate_agf(
                priv.nr_blocks = 0;
 
                levels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]);
-               if (levels >= XFS_BTREE_MAXLEVELS) {
+               if (levels == 0 || levels > XFS_BTREE_MAXLEVELS) {
                        do_warn(_("bad levels %u for rmapbt root, agno %d\n"),
                                levels, agno);
                        rmap_avoid_check();
@@ -2323,7 +2323,7 @@ validate_agf(
                unsigned int    levels;
 
                levels = be32_to_cpu(agf->agf_refcount_level);
-               if (levels >= XFS_BTREE_MAXLEVELS) {
+               if (levels == 0 || levels > XFS_BTREE_MAXLEVELS) {
                        do_warn(_("bad levels %u for refcountbt root, agno %d\n"),
                                levels, agno);
                        refcount_avoid_check();