mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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:
parent
31ca03c92c
commit
a6a781a58b
21 changed files with 323 additions and 275 deletions
|
@ -2491,7 +2491,7 @@ xfs_check_agi_unlinked(
|
|||
#define xfs_check_agi_unlinked(agi)
|
||||
#endif
|
||||
|
||||
static bool
|
||||
static xfs_failaddr_t
|
||||
xfs_agi_verify(
|
||||
struct xfs_buf *bp)
|
||||
{
|
||||
|
@ -2500,28 +2500,28 @@ xfs_agi_verify(
|
|||
|
||||
if (xfs_sb_version_hascrc(&mp->m_sb)) {
|
||||
if (!uuid_equal(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid))
|
||||
return false;
|
||||
return __this_address;
|
||||
if (!xfs_log_check_lsn(mp,
|
||||
be64_to_cpu(XFS_BUF_TO_AGI(bp)->agi_lsn)))
|
||||
return false;
|
||||
return __this_address;
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate the magic number of the agi block.
|
||||
*/
|
||||
if (agi->agi_magicnum != cpu_to_be32(XFS_AGI_MAGIC))
|
||||
return false;
|
||||
return __this_address;
|
||||
if (!XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum)))
|
||||
return false;
|
||||
return __this_address;
|
||||
|
||||
if (be32_to_cpu(agi->agi_level) < 1 ||
|
||||
be32_to_cpu(agi->agi_level) > XFS_BTREE_MAXLEVELS)
|
||||
return false;
|
||||
return __this_address;
|
||||
|
||||
if (xfs_sb_version_hasfinobt(&mp->m_sb) &&
|
||||
(be32_to_cpu(agi->agi_free_level) < 1 ||
|
||||
be32_to_cpu(agi->agi_free_level) > XFS_BTREE_MAXLEVELS))
|
||||
return false;
|
||||
return __this_address;
|
||||
|
||||
/*
|
||||
* during growfs operations, the perag is not fully initialised,
|
||||
|
@ -2530,10 +2530,10 @@ xfs_agi_verify(
|
|||
* so we can detect and avoid this problem.
|
||||
*/
|
||||
if (bp->b_pag && be32_to_cpu(agi->agi_seqno) != bp->b_pag->pag_agno)
|
||||
return false;
|
||||
return __this_address;
|
||||
|
||||
xfs_check_agi_unlinked(agi);
|
||||
return true;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2545,7 +2545,7 @@ xfs_agi_read_verify(
|
|||
if (xfs_sb_version_hascrc(&mp->m_sb) &&
|
||||
!xfs_buf_verify_cksum(bp, XFS_AGI_CRC_OFF))
|
||||
xfs_verifier_error(bp, -EFSBADCRC);
|
||||
else if (XFS_TEST_ERROR(!xfs_agi_verify(bp), mp,
|
||||
else if (XFS_TEST_ERROR(xfs_agi_verify(bp), mp,
|
||||
XFS_ERRTAG_IALLOC_READ_AGI))
|
||||
xfs_verifier_error(bp, -EFSCORRUPTED);
|
||||
}
|
||||
|
@ -2557,7 +2557,7 @@ xfs_agi_write_verify(
|
|||
struct xfs_mount *mp = bp->b_target->bt_mount;
|
||||
struct xfs_buf_log_item *bip = bp->b_fspriv;
|
||||
|
||||
if (!xfs_agi_verify(bp)) {
|
||||
if (xfs_agi_verify(bp)) {
|
||||
xfs_verifier_error(bp, -EFSCORRUPTED);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue