xfs: have buffer verifier functions report failing address
Modify each function that checks the contents of a metadata buffer to return the instruction address of the failing test so that we can report more precise failure errors to the log. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
@@ -223,29 +223,31 @@ xfs_refcountbt_diff_two_keys(
|
||||
be32_to_cpu(k2->refc.rc_startblock);
|
||||
}
|
||||
|
||||
STATIC bool
|
||||
STATIC xfs_failaddr_t
|
||||
xfs_refcountbt_verify(
|
||||
struct xfs_buf *bp)
|
||||
{
|
||||
struct xfs_mount *mp = bp->b_target->bt_mount;
|
||||
struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
|
||||
struct xfs_perag *pag = bp->b_pag;
|
||||
xfs_failaddr_t fa;
|
||||
unsigned int level;
|
||||
|
||||
if (block->bb_magic != cpu_to_be32(XFS_REFC_CRC_MAGIC))
|
||||
return false;
|
||||
return __this_address;
|
||||
|
||||
if (!xfs_sb_version_hasreflink(&mp->m_sb))
|
||||
return false;
|
||||
if (!xfs_btree_sblock_v5hdr_verify(bp))
|
||||
return false;
|
||||
return __this_address;
|
||||
fa = xfs_btree_sblock_v5hdr_verify(bp);
|
||||
if (fa)
|
||||
return fa;
|
||||
|
||||
level = be16_to_cpu(block->bb_level);
|
||||
if (pag && pag->pagf_init) {
|
||||
if (level >= pag->pagf_refcount_level)
|
||||
return false;
|
||||
return __this_address;
|
||||
} else if (level >= mp->m_refc_maxlevels)
|
||||
return false;
|
||||
return __this_address;
|
||||
|
||||
return xfs_btree_sblock_verify(bp, mp->m_refc_mxr[level != 0]);
|
||||
}
|
||||
@@ -256,7 +258,7 @@ xfs_refcountbt_read_verify(
|
||||
{
|
||||
if (!xfs_btree_sblock_verify_crc(bp))
|
||||
xfs_verifier_error(bp, -EFSBADCRC);
|
||||
else if (!xfs_refcountbt_verify(bp))
|
||||
else if (xfs_refcountbt_verify(bp))
|
||||
xfs_verifier_error(bp, -EFSCORRUPTED);
|
||||
|
||||
if (bp->b_error)
|
||||
@@ -267,7 +269,7 @@ STATIC void
|
||||
xfs_refcountbt_write_verify(
|
||||
struct xfs_buf *bp)
|
||||
{
|
||||
if (!xfs_refcountbt_verify(bp)) {
|
||||
if (xfs_refcountbt_verify(bp)) {
|
||||
trace_xfs_btree_corrupt(bp, _RET_IP_);
|
||||
xfs_verifier_error(bp, -EFSCORRUPTED);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user