LEAFN node level is N -- bogus warning
In xfs_repair / dir2.c there's a check for the 'level' of a directory leaf node within the btree hierarchy. A warning 'LEAFN node level is N' is generated if the level >= 1.
But leaf nodes don't have a /level/ member, although internal nodes do (compare xfs_dir2_leaf_hdr_t and xfs_da_intnode_t). xfs_repair is actually testing leaf->hdr.stale - so the warning is bogus.
The attached patch removes the test and make the relationship between magic numbers and pointer types more explicit.
--
Roger
dir2.c 2006-09-12 17:04:44.000000000 +0100 renamed from dir2.c.~1.19.~ 2006-06-30 15:38:12.000000000 +0100 +1 -0
@@ -258,5 +258,6 @@ xfs_dabuf_t *bp; int i; int nex; + xfs_da_blkinfo_t *info; xfs_da_intnode_t *node; bmap_ext_t lbmp;
@@ -268,5 +269,5 @@
*/
bno = mp->m_dirleafblk;
i = -1;
- node = NULL;
+ info = NULL;
da_cursor->active = 0;
do {
@@ -291,2 +292,2 @@
goto error_out;
}- node = bp->data;
+ info = bp->data;
- if (INT_GET(node->hdr.info.magic, ARCH_CONVERT) ==
+ if (INT_GET(info->magic, ARCH_CONVERT) ==
XFS_DIR2_LEAFN_MAGIC) {
if ( i != -1 ) {
do_warn(_("found non-root LEAFN node in inode "
"%llu bno = %u\n"),
da_cursor->ino, bno);
}- if (INT_GET(node->hdr.level, ARCH_CONVERT) >= 1) {
- do_warn(_("LEAFN node level is %d inode %llu "
- "bno = %u\n"),
- INT_GET(node->hdr.level, ARCH_CONVERT),
- da_cursor->ino, bno);
- }
*rbno = 0;
da_brelse(bp);
return(1);
- } else if (INT_GET(node->hdr.info.magic, ARCH_CONVERT) !=
+ } else if (INT_GET(info->magic, ARCH_CONVERT) !=
XFS_DA_NODE_MAGIC) {
da_brelse(bp);
do_warn(_("bad dir magic number 0x%x in inode %llu "
"bno = %u\n"),
- INT_GET(node->hdr.info.magic, ARCH_CONVERT),
+ INT_GET(info->magic, ARCH_CONVERT),
da_cursor->ino, bno);
goto error_out;
}
+ node = bp->data;
+ ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) ==
+ XFS_DA_NODE_MAGIC);
if (INT_GET(node->hdr.count, ARCH_CONVERT) >
mp->m_dir_node_ents) {
da_brelse(bp);Hi Roger,
Just to let you know, I now have a filesystem that is displaying this warning, so I am looking into it in combination with your patch. I'll let you know how it goes.
Regards,
Barry.
Quoted 24 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Roger Willcocks
Sent: Wednesday, 13 September 2006 2:23 AM
To: [email protected]
Subject: LEAFN node level is N -- bogus warningIn
xfs_repair/dir2.cthere's a check for the 'level' of a directory leaf node within the btree hierarchy. A warning 'LEAFN node level is N' is generated if the level >= 1.But leaf nodes don't have a /level/ member, although internal nodes do (compare
xfs_dir2_leaf_hdr_tandxfs_da_intnode_t).xfs_repairis actually testingleaf->hdr.stale- so the warning is bogus.The attached patch removes the test and make the relationship between magic numbers and pointer types more explicit.
--
Roger