fsck.gfs2: link count checking wrong inode's formal inode number
PATCH 1/1 fsck.gfs2: link count checking wrong inode's formal inode number
In reply to a message not in the archiveHi,
This patch fixes a bug whereby inodes that aren't in the dirtree or the inodetree are checking the wrong formal inode number. Function incr_link_count checks the wrong inode value, and thus reports an error where there are none. Also, when the error is reported back, it reports the wrong value, using a copy of the inum value. In this case, it should look up the dentry's inode's formal inode number. This should only hurt performance in error cases.
Signed-off-by Bob Peterson <[email protected]>
gfs2/fsck/link.c +1 -1
@@ -112,7 +112,7 @@ int incr_link_count(struct gfs2_inum no, struct gfs2_inode *ip, link_ip =fsck_load_inode (ip->i_sbd, no.no_addr);/* Check formal ino against dinode before adding to inode tree. */ -if (no.no_formal_ino != ip->i_di.di_num.no_formal_ino) { +if (no.no_formal_ino != link_ip->i_di.di_num.no_formal_ino) {fsck_inode_put (&link_ip);return 1 ; }
gfs2/fsck/pass2.c +7 -2
@@ -195,8 +195,13 @@ static int bad_formal_ino(struct gfs2_inode *ip, struct gfs2_dirent *dent, di =dirtree_find (entry.no_addr);if (di) inum = di->dinode; -else if (link1_type (&clink1map, entry.no_addr) ==1 ) - inum = entry; +else if (link1_type (&clink1map, entry.no_addr) ==1 ) { +struct gfs2_inode *dent_ip; + + dent_ip =fsck_load_inode (ip->i_sbd, entry.no_addr); + inum = dent_ip->i_di.di_num; +fsck_inode_put (&dent_ip); + } } log_err( _("Directory entry '%s' pointing to block %llu (0x%llx) in " "directory %llu (0x%llx) has the wrong 'formal' inode "