All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_db: properly set inode type
@ 2017-06-28  0:16 Eric Sandeen
  2017-06-28  0:42 ` Darrick J. Wong
  2017-07-18  1:51 ` [PATCH V2] " Eric Sandeen
  0 siblings, 2 replies; 13+ messages in thread
From: Eric Sandeen @ 2017-06-28  0:16 UTC (permalink / raw)
  To: linux-xfs

When we set the type to "inode" the verifier validates multiple
inodes in the current fs block, so setting the buffer size to
that of just one inode is not sufficient and it'll emit spurious
verifier errors for all but the first, as we read off the end:

xfs_db> daddr 99
xfs_db> type inode
Metadata corruption detected at xfs_inode block 0x63/0x200
Metadata corruption detected at xfs_inode block 0x63/0x200
Metadata corruption detected at xfs_inode block 0x63/0x200
Metadata corruption detected at xfs_inode block 0x63/0x200
Metadata corruption detected at xfs_inode block 0x63/0x200
Metadata corruption detected at xfs_inode block 0x63/0x200
Metadata corruption detected at xfs_inode block 0x63/0x200

Use the special set_cur_inode() function for this purpose
as is done in inode_f().

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/db/io.c b/db/io.c
index b97b710..655a978 100644
--- a/db/io.c
+++ b/db/io.c
@@ -618,6 +618,18 @@ set_iocur_type(
 	struct xfs_buf	*bp = iocur_top->bp;
 	int bb_count;
 
+	/* Inodes are special; verifier checks all inodes in the buffer */
+	if (t->typnm == TYP_INODE) {
+		xfs_daddr_t	b = iocur_top->bb;
+		xfs_ino_t	ino;
+
+		ino = XFS_AGINO_TO_INO(mp, xfs_daddr_to_agno(mp, b),
+			((b << BBSHIFT) >> mp->m_sb.sb_inodelog) %
+			(mp->m_sb.sb_agblocks << mp->m_sb.sb_inopblog));
+		set_cur_inode(ino);
+		return;
+	}
+
 	/* adjust cursor for types that contain fields */
 	if (t->fields) {
 		bb_count = BTOBB(byteize(fsize(t->fields, iocur_top->data, 0, 0)));


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-07-18 21:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28  0:16 [PATCH] xfs_db: properly set inode type Eric Sandeen
2017-06-28  0:42 ` Darrick J. Wong
2017-06-28  0:47   ` Eric Sandeen
2017-06-28 22:45   ` Eric Sandeen
2017-06-28 23:54     ` Darrick J. Wong
2017-06-29  4:01       ` Eric Sandeen
2017-07-17 20:51         ` Eric Sandeen
2017-07-17 21:07           ` Darrick J. Wong
2017-07-18  2:20           ` Dave Chinner
2017-07-18  2:25             ` Eric Sandeen
2017-07-18  2:56               ` Dave Chinner
2017-07-18  1:51 ` [PATCH V2] " Eric Sandeen
2017-07-18 21:26   ` Bill O'Donnell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.