]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: fix freespace btree record validation
authorChristoph Hellwig <hch@lst.de>
Sat, 2 Jan 2010 11:12:19 +0000 (12:12 +0100)
committerChristoph Hellwig <hch@lst.de>
Sat, 2 Jan 2010 11:12:19 +0000 (12:12 +0100)
MAXEXTLEN is a limit for the bmap btree extent length, not for the freespace
btrees which can fill out the whole u32.  Remove the check which makes
repair skip too large freespace extents.  Also add warnings for freespace
btree records that fail the remaining validations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
repair/scan.c

index 5f5743e63af6c9b7363c54ca9cf31deaa78085e0..742489438046b222b2f5ff3173ebb67666649754 100644 (file)
@@ -520,12 +520,18 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
                        len = be32_to_cpu(rp[i].ar_blockcount);
                        end = b + len;
 
-                       if (b == 0 || !verify_agbno(mp, agno, b))
-                               continue;
-                       if (len == 0 || len > MAXEXTLEN)
+                       if (b == 0 || !verify_agbno(mp, agno, b)) {
+                               do_warn(
+       _("invalid start block %u in record %u of %d btree block %u/%u"),
+                                       b, i, name, agno, bno);
                                continue;
-                       if (!verify_agbno(mp, agno, end - 1))
+                       }
+                       if (len == 0 || !verify_agbno(mp, agno, end - 1)) {
+                               do_warn(
+       _("invalid length %u in record %u of %d btree block %u/%u"),
+                                       len, i, name, agno, bno);
                                continue;
+                       }
 
                        for ( ; b < end; b += blen)  {
                                state = get_bmap_ext(agno, b, end, &blen);