aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2017-07-20 10:51:46 -0500
committerEric Sandeen <sandeen@redhat.com>2017-07-20 10:51:46 -0500
commit533d1d229a881d5a58a232377c409a3dd7a5cd6f (patch)
treeaa5b77ccc39da93a43342dc2818252f97f86aeeb
parent4944defad4ae2cbcf056207490d7c597bb92cd7c (diff)
downloadxfsprogs-dev-533d1d229a881d5a58a232377c409a3dd7a5cd6f.tar.gz
xfs_db: properly set inode type
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> Reviewed-by: Bill O'Donnell <billodo@redhat.com> [sandeen: remove nag/warning printf for now] Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--db/io.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/io.c b/db/io.c
index b046c8d37f..1f27f6b334 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 chunk */
+ if (type->typnm == TYP_INODE) {
+ xfs_daddr_t b = iocur_top->bb;
+ xfs_ino_t ino;
+
+ /*
+ * Note that this will back up to the beginning of the inode
+ * which contains the current disk location; daddr may change.
+ */
+ 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 buffer size for types with fields & hence fsize() */
if (type->fields) {
int bb_count; /* type's size in basic blocks */