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

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