xfs
[Top] [All Lists]

[PATCH 1/3] repair: fix freespace btree record validation

To: xfs@xxxxxxxxxxx
Subject: [PATCH 1/3] repair: fix freespace btree record validation
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Tue, 01 Dec 2009 10:05:04 -0500
References: <20091201150503.958283878@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.47-1
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@xxxxxx>

Index: xfsprogs-dev/repair/scan.c
===================================================================
--- xfsprogs-dev.orig/repair/scan.c     2009-12-01 13:02:49.000000000 +0000
+++ xfsprogs-dev/repair/scan.c  2009-12-01 14:45:14.000000000 +0000
@@ -520,12 +520,18 @@ _("%s freespace btree block claimed (sta
                        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);

<Prev in Thread] Current Thread [Next in Thread>