All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Eric Sandeen <sandeen@redhat.com>, linux-xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH V2] xfs_db: properly set inode type
Date: Mon, 17 Jul 2017 20:51:13 -0500	[thread overview]
Message-ID: <c17ce413-430e-acce-e63d-51fd1b684f62@sandeen.net> (raw)
In-Reply-To: <e6c83eea-af29-c01b-752e-e049e8fdc69f@redhat.com>

When we set the type to "inode" the verifier may validate 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>
---

V2: Warn if the daddr given was reset to an inode-aligned
address

diff --git a/db/io.c b/db/io.c
index b046c8d..4153da0 100644
--- a/db/io.c
+++ b/db/io.c
@@ -616,6 +616,22 @@ set_iocur_type(
 {
 	struct xfs_buf	*bp = iocur_top->bp;
 
+	/* Inodes are special; verifier checks all inodes in the buffer */
+	if (type->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);
+		if (iocur_top->bb != b)
+			dbprintf(
+_("cursor set to nearest inode %llu at daddr %lld\n"),
+				 ino, iocur_top->bb);
+		return;
+	}
+
 	/* adjust buffer size for types with fields & hence fsize() */
 	if (type->fields) {
 		int bb_count;	/* type's size in basic blocks */


  parent reply	other threads:[~2017-07-18  1:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Eric Sandeen [this message]
2017-07-18 21:26   ` [PATCH V2] " Bill O'Donnell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c17ce413-430e-acce-e63d-51fd1b684f62@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.