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

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