mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-18 21:25:11 +00:00
xfs: refactor inode buffer verifier error logging
When the inode buffer verifier encounters an error, it's much more helpful to print a buffer from the offending inode instead of just the start of the inode chunk buffer. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
parent
90a58f9571
commit
6edb181053
3 changed files with 45 additions and 21 deletions
fs/xfs
|
@ -115,13 +115,15 @@ xfs_inode_buf_verify(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfs_verifier_error(bp, -EFSCORRUPTED, __this_address);
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
xfs_alert(mp,
|
xfs_alert(mp,
|
||||||
"bad inode magic/vsn daddr %lld #%d (magic=%x)",
|
"bad inode magic/vsn daddr %lld #%d (magic=%x)",
|
||||||
(unsigned long long)bp->b_bn, i,
|
(unsigned long long)bp->b_bn, i,
|
||||||
be16_to_cpu(dip->di_magic));
|
be16_to_cpu(dip->di_magic));
|
||||||
#endif
|
#endif
|
||||||
|
xfs_buf_verifier_error(bp, -EFSCORRUPTED,
|
||||||
|
__func__, dip, sizeof(*dip),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xfs_inobp_check(mp, bp);
|
xfs_inobp_check(mp, bp);
|
||||||
|
|
|
@ -342,6 +342,43 @@ xfs_corruption_error(
|
||||||
xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
|
xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Warnings specifically for verifier errors. Differentiate CRC vs. invalid
|
||||||
|
* values, and omit the stack trace unless the error level is tuned high.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xfs_buf_verifier_error(
|
||||||
|
struct xfs_buf *bp,
|
||||||
|
int error,
|
||||||
|
const char *name,
|
||||||
|
void *buf,
|
||||||
|
size_t bufsz,
|
||||||
|
xfs_failaddr_t failaddr)
|
||||||
|
{
|
||||||
|
struct xfs_mount *mp = bp->b_target->bt_mount;
|
||||||
|
xfs_failaddr_t fa;
|
||||||
|
int sz;
|
||||||
|
|
||||||
|
fa = failaddr ? failaddr : __return_address;
|
||||||
|
__xfs_buf_ioerror(bp, error, fa);
|
||||||
|
|
||||||
|
xfs_alert(mp, "Metadata %s detected at %pS, %s block 0x%llx %s",
|
||||||
|
bp->b_error == -EFSBADCRC ? "CRC error" : "corruption",
|
||||||
|
fa, bp->b_ops->name, bp->b_bn, name);
|
||||||
|
|
||||||
|
xfs_alert(mp, "Unmount and run xfs_repair");
|
||||||
|
|
||||||
|
if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
|
||||||
|
sz = min_t(size_t, XFS_CORRUPTION_DUMP_LEN, bufsz);
|
||||||
|
xfs_alert(mp, "First %d bytes of corrupted metadata buffer:",
|
||||||
|
sz);
|
||||||
|
xfs_hex_dump(buf, sz);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
|
||||||
|
xfs_stack_trace();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Warnings specifically for verifier errors. Differentiate CRC vs. invalid
|
* Warnings specifically for verifier errors. Differentiate CRC vs. invalid
|
||||||
* values, and omit the stack trace unless the error level is tuned high.
|
* values, and omit the stack trace unless the error level is tuned high.
|
||||||
|
@ -352,26 +389,8 @@ xfs_verifier_error(
|
||||||
int error,
|
int error,
|
||||||
xfs_failaddr_t failaddr)
|
xfs_failaddr_t failaddr)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = bp->b_target->bt_mount;
|
return xfs_buf_verifier_error(bp, error, "", xfs_buf_offset(bp, 0),
|
||||||
xfs_failaddr_t fa;
|
XFS_CORRUPTION_DUMP_LEN, failaddr);
|
||||||
|
|
||||||
fa = failaddr ? failaddr : __return_address;
|
|
||||||
__xfs_buf_ioerror(bp, error, fa);
|
|
||||||
|
|
||||||
xfs_alert(mp, "Metadata %s detected at %pS, %s block 0x%llx",
|
|
||||||
bp->b_error == -EFSBADCRC ? "CRC error" : "corruption",
|
|
||||||
fa, bp->b_ops->name, bp->b_bn);
|
|
||||||
|
|
||||||
xfs_alert(mp, "Unmount and run xfs_repair");
|
|
||||||
|
|
||||||
if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
|
|
||||||
xfs_alert(mp, "First %d bytes of corrupted metadata buffer:",
|
|
||||||
XFS_CORRUPTION_DUMP_LEN);
|
|
||||||
xfs_hex_dump(xfs_buf_offset(bp, 0), XFS_CORRUPTION_DUMP_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
|
|
||||||
xfs_stack_trace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -26,6 +26,9 @@ extern void xfs_error_report(const char *tag, int level, struct xfs_mount *mp,
|
||||||
extern void xfs_corruption_error(const char *tag, int level,
|
extern void xfs_corruption_error(const char *tag, int level,
|
||||||
struct xfs_mount *mp, void *p, const char *filename,
|
struct xfs_mount *mp, void *p, const char *filename,
|
||||||
int linenum, xfs_failaddr_t failaddr);
|
int linenum, xfs_failaddr_t failaddr);
|
||||||
|
extern void xfs_buf_verifier_error(struct xfs_buf *bp, int error,
|
||||||
|
const char *name, void *buf, size_t bufsz,
|
||||||
|
xfs_failaddr_t failaddr);
|
||||||
extern void xfs_verifier_error(struct xfs_buf *bp, int error,
|
extern void xfs_verifier_error(struct xfs_buf *bp, int error,
|
||||||
xfs_failaddr_t failaddr);
|
xfs_failaddr_t failaddr);
|
||||||
extern void xfs_inode_verifier_error(struct xfs_inode *ip, int error,
|
extern void xfs_inode_verifier_error(struct xfs_inode *ip, int error,
|
||||||
|
|
Loading…
Add table
Reference in a new issue