Blame SOURCES/0001-xfs_repair-initialize-non-leaf-finobt-blocks-with-co.patch

b2261c
From 051dae5efb4fc7c1c47ccb72ff161241fb0815ee Mon Sep 17 00:00:00 2001
b2261c
From: Brian Foster <bfoster@redhat.com>
b2261c
Date: Mon, 28 Jan 2019 16:05:16 -0600
b2261c
Subject: [PATCH] xfs_repair: initialize non-leaf finobt blocks with correct
b2261c
 magic
b2261c
b2261c
The free inode btree construction code in xfs_repair has a bug where
b2261c
any non-leaf nodes outside of the leftmost block at the associated
b2261c
level in the tree are incorrectly initialized with the inobt magic
b2261c
value. Update the prop_ino_cursor() path responsible for growing the
b2261c
non-leaf portion of the inode btrees to use the btnum of the
b2261c
specific tree being generated rather than the hardcoded inode btree
b2261c
type.
b2261c
b2261c
Signed-off-by: Brian Foster <bfoster@redhat.com>
b2261c
Reported-by: Lucas Stach <l.stach@pengutronix.de>
b2261c
Root-caused-by: Lucas Stach <l.stach@pengutronix.de>
b2261c
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
b2261c
Reviewed-by: Dave Chinner <dchinner@redhat.com>
b2261c
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
b2261c
---
b2261c
 repair/phase5.c | 10 +++++-----
b2261c
 1 file changed, 5 insertions(+), 5 deletions(-)
b2261c
b2261c
diff --git a/repair/phase5.c b/repair/phase5.c
b2261c
index 1bacfc7..e8f9f46 100644
b2261c
--- a/repair/phase5.c
b2261c
+++ b/repair/phase5.c
b2261c
@@ -983,7 +983,7 @@ init_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
b2261c
 
b2261c
 static void
b2261c
 prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
b2261c
-	xfs_agino_t startino, int level)
b2261c
+	xfs_btnum_t btnum, xfs_agino_t startino, int level)
b2261c
 {
b2261c
 	struct xfs_btree_block	*bt_hdr;
b2261c
 	xfs_inobt_key_t		*bt_key;
b2261c
@@ -1005,7 +1005,7 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
b2261c
 		 * first path up the left side of the tree
b2261c
 		 * where the agbno's are already set up
b2261c
 		 */
b2261c
-		prop_ino_cursor(mp, agno, btree_curs, startino, level);
b2261c
+		prop_ino_cursor(mp, agno, btree_curs, btnum, startino, level);
b2261c
 	}
b2261c
 
b2261c
 	if (be16_to_cpu(bt_hdr->bb_numrecs) ==
b2261c
@@ -1041,7 +1041,7 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
b2261c
 		lptr->buf_p->b_ops = &xfs_inobt_buf_ops;
b2261c
 		bt_hdr = XFS_BUF_TO_BLOCK(lptr->buf_p);
b2261c
 		memset(bt_hdr, 0, mp->m_sb.sb_blocksize);
b2261c
-		libxfs_btree_init_block(mp, lptr->buf_p, XFS_BTNUM_INO,
b2261c
+		libxfs_btree_init_block(mp, lptr->buf_p, btnum,
b2261c
 					level, 0, agno, 0);
b2261c
 
b2261c
 		bt_hdr->bb_u.s.bb_leftsib = cpu_to_be32(lptr->prev_agbno);
b2261c
@@ -1049,7 +1049,7 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
b2261c
 		/*
b2261c
 		 * propagate extent record for first extent in new block up
b2261c
 		 */
b2261c
-		prop_ino_cursor(mp, agno, btree_curs, startino, level);
b2261c
+		prop_ino_cursor(mp, agno, btree_curs, btnum, startino, level);
b2261c
 	}
b2261c
 	/*
b2261c
 	 * add inode info to current block
b2261c
@@ -1201,7 +1201,7 @@ build_ino_tree(xfs_mount_t *mp, xfs_agnumber_t agno,
b2261c
 			lptr->modulo--;
b2261c
 
b2261c
 		if (lptr->num_recs_pb > 0)
b2261c
-			prop_ino_cursor(mp, agno, btree_curs,
b2261c
+			prop_ino_cursor(mp, agno, btree_curs, btnum,
b2261c
 					ino_rec->ino_startnum, 0);
b2261c
 
b2261c
 		bt_rec = (xfs_inobt_rec_t *)
b2261c
-- 
b2261c
2.9.5
b2261c