xfs: refactor inode verifier corruption error printing

Refactor inode verifier error reporting into a non-libxfs function so
that we aren't encoding the message format in libxfs.  This also
changes the kernel dmesg output to resemble buffer verifier errors
more closely.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Darrick J. Wong
2018-01-22 18:09:48 -08:00
parent 67a3f6d014
commit 22431bf3df
4 changed files with 50 additions and 10 deletions

View File

@@ -3486,21 +3486,23 @@ bool
xfs_inode_verify_forks(
struct xfs_inode *ip)
{
struct xfs_ifork *ifp;
xfs_failaddr_t fa;
fa = xfs_ifork_verify_data(ip, &xfs_default_ifork_ops);
if (fa) {
xfs_alert(ip->i_mount,
"%s: bad inode %llu inline data fork at %pS",
__func__, ip->i_ino, fa);
ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
xfs_inode_verifier_error(ip, -EFSCORRUPTED, "data fork",
ifp->if_u1.if_data, ifp->if_bytes, fa);
return false;
}
fa = xfs_ifork_verify_attr(ip, &xfs_default_ifork_ops);
if (fa) {
xfs_alert(ip->i_mount,
"%s: bad inode %llu inline attr fork at %pS",
__func__, ip->i_ino, fa);
ifp = XFS_IFORK_PTR(ip, XFS_ATTR_FORK);
xfs_inode_verifier_error(ip, -EFSCORRUPTED, "attr fork",
ifp ? ifp->if_u1.if_data : NULL,
ifp ? ifp->if_bytes : 0, fa);
return false;
}
return true;