From: Eric Sandeen Date: Thu, 20 Jul 2017 15:51:46 +0000 (-0500) Subject: xfs_db: properly set inode type X-Git-Tag: v4.12.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=533d1d229a881d5a58a232377c409a3dd7a5cd6f;p=thirdparty%2Fxfsprogs-dev.git 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 Reviewed-by: Bill O'Donnell [sandeen: remove nag/warning printf for now] Signed-off-by: Eric Sandeen --- diff --git a/db/io.c b/db/io.c index b046c8d37..1f27f6b33 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 */