#define xfs_reinit_percpu_counters(mp)
void xfs_trans_mod_sb(struct xfs_trans *, uint, long);
-void xfs_verifier_error(struct xfs_buf *bp, int error, xfs_failaddr_t failaddr);
+void xfs_verifier_error(struct xfs_buf *bp, int error,
+ xfs_failaddr_t failaddr);
+void xfs_inode_verifier_error(struct xfs_inode *ip, int error,
+ const char *name, void *buf, size_t bufsz,
+ xfs_failaddr_t failaddr);
/* XXX: this is clearly a bug - a shared header needs to export this */
/* xfs_rtalloc.c */
libxfs_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 %Lu inline data fork at %pF",
- __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 %Lu inline attr fork at %pF",
- __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;
bp->b_ops->name, bp->b_bn, BBTOB(bp->b_length));
}
+/*
+ * Warnings for inode corruption problems. Don't bother with the stack
+ * trace unless the error level is turned up high.
+ */
+void
+xfs_inode_verifier_error(
+ struct xfs_inode *ip,
+ int error,
+ const char *name,
+ void *buf,
+ size_t bufsz,
+ xfs_failaddr_t failaddr)
+{
+ xfs_alert(NULL, "Metadata %s detected at %p, inode 0x%llx %s",
+ error == -EFSBADCRC ? "CRC error" : "corruption",
+ failaddr ? failaddr : __return_address,
+ ip->i_ino, name);
+}
+
/*
* This is called from I/O verifiers on v5 superblock filesystems. In the
* kernel, it validates the metadata LSN parameter against the current LSN of
/* even unallocated inodes are verified */
fa = xfs_dinode_verify(mp, ip->i_ino, dip);
if (fa) {
- xfs_alert(mp, "%s: validation failed for inode %lld at %pS",
- __func__, ip->i_ino, fa);
-
- XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, dip);
+ xfs_inode_verifier_error(ip, -EFSCORRUPTED, "dinode", dip,
+ sizeof(*dip), fa);
error = -EFSCORRUPTED;
goto out_brelse;
}