Blame SOURCES/xfsprogs-4.12.0-xfs_db-properly-set-inode-type.patch

9bf599
From 533d1d229a881d5a58a232377c409a3dd7a5cd6f Mon Sep 17 00:00:00 2001
9bf599
From: Eric Sandeen <sandeen@redhat.com>
9bf599
Date: Thu, 20 Jul 2017 10:51:46 -0500
9bf599
Subject: [PATCH] xfs_db: properly set inode type
9bf599
9bf599
When we set the type to "inode" the verifier validates multiple
9bf599
inodes in the current fs block, so setting the buffer size to
9bf599
that of just one inode is not sufficient and it'll emit spurious
9bf599
verifier errors for all but the first, as we read off the end:
9bf599
9bf599
xfs_db> daddr 99
9bf599
xfs_db> type inode
9bf599
Metadata corruption detected at xfs_inode block 0x63/0x200
9bf599
Metadata corruption detected at xfs_inode block 0x63/0x200
9bf599
Metadata corruption detected at xfs_inode block 0x63/0x200
9bf599
Metadata corruption detected at xfs_inode block 0x63/0x200
9bf599
Metadata corruption detected at xfs_inode block 0x63/0x200
9bf599
Metadata corruption detected at xfs_inode block 0x63/0x200
9bf599
Metadata corruption detected at xfs_inode block 0x63/0x200
9bf599
9bf599
Use the special set_cur_inode() function for this purpose
9bf599
as is done in inode_f().
9bf599
9bf599
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
9bf599
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
9bf599
[sandeen: remove nag/warning printf for now]
9bf599
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
9bf599
---
9bf599
 db/io.c | 16 ++++++++++++++++
9bf599
 1 file changed, 16 insertions(+)
9bf599
9bf599
Index: xfsprogs-rhel7.5/db/io.c
9bf599
===================================================================
9bf599
--- xfsprogs-rhel7.5.orig/db/io.c
9bf599
+++ xfsprogs-rhel7.5/db/io.c
9bf599
@@ -567,6 +567,22 @@ set_iocur_type(
9bf599
 {
9bf599
 	struct xfs_buf	*bp = iocur_top->bp;
9bf599
 
9bf599
+	/* Inodes are special; verifier checks all inodes in the chunk */
9bf599
+	if (type->typnm == TYP_INODE) {
9bf599
+		xfs_daddr_t	b = iocur_top->bb;
9bf599
+		xfs_ino_t	ino;
9bf599
+
9bf599
+		/*
9bf599
+		 * Note that this will back up to the beginning of the inode
9bf599
+ 		 * which contains the current disk location; daddr may change.
9bf599
+ 		 */
9bf599
+		ino = XFS_AGINO_TO_INO(mp, xfs_daddr_to_agno(mp, b),
9bf599
+			((b << BBSHIFT) >> mp->m_sb.sb_inodelog) %
9bf599
+			(mp->m_sb.sb_agblocks << mp->m_sb.sb_inopblog));
9bf599
+		set_cur_inode(ino);
9bf599
+		return;
9bf599
+	}
9bf599
+
9bf599
 	/* adjust buffer size for types with fields & hence fsize() */
9bf599
 	if (type->fields) {
9bf599
 		int bb_count;	/* type's size in basic blocks */