diff options
Diffstat (limited to 'fs/xfs/scrub/inode.c')
| -rw-r--r-- | fs/xfs/scrub/inode.c | 19 | 
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c index 6e2fe2d6250b..d32716fb2fec 100644 --- a/fs/xfs/scrub/inode.c +++ b/fs/xfs/scrub/inode.c @@ -739,6 +739,23 @@ xchk_inode_check_reflink_iflag(  		xchk_ino_set_corrupt(sc, ino);  } +/* + * If this inode has zero link count, it must be on the unlinked list.  If + * it has nonzero link count, it must not be on the unlinked list. + */ +STATIC void +xchk_inode_check_unlinked( +	struct xfs_scrub	*sc) +{ +	if (VFS_I(sc->ip)->i_nlink == 0) { +		if (!xfs_inode_on_unlinked_list(sc->ip)) +			xchk_ino_set_corrupt(sc, sc->ip->i_ino); +	} else { +		if (xfs_inode_on_unlinked_list(sc->ip)) +			xchk_ino_set_corrupt(sc, sc->ip->i_ino); +	} +} +  /* Scrub an inode. */  int  xchk_inode( @@ -771,6 +788,8 @@ xchk_inode(  	if (S_ISREG(VFS_I(sc->ip)->i_mode))  		xchk_inode_check_reflink_iflag(sc, sc->ip->i_ino); +	xchk_inode_check_unlinked(sc); +  	xchk_inode_xref(sc, sc->ip->i_ino, &di);  out:  	return error;  |