aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ialloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_ialloc.c')
-rw-r--r--fs/xfs/xfs_ialloc.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 5d7f105a1c82..5959b3b4c7c9 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -1568,18 +1568,17 @@ xfs_agi_read_verify(
1568 struct xfs_buf *bp) 1568 struct xfs_buf *bp)
1569{ 1569{
1570 struct xfs_mount *mp = bp->b_target->bt_mount; 1570 struct xfs_mount *mp = bp->b_target->bt_mount;
1571 int agi_ok = 1;
1572 1571
1573 if (xfs_sb_version_hascrc(&mp->m_sb)) 1572 if (xfs_sb_version_hascrc(&mp->m_sb) &&
1574 agi_ok = xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length), 1573 !xfs_buf_verify_cksum(bp, XFS_AGI_CRC_OFF))
1575 offsetof(struct xfs_agi, agi_crc)); 1574 xfs_buf_ioerror(bp, EFSBADCRC);
1576 agi_ok = agi_ok && xfs_agi_verify(bp); 1575 else if (XFS_TEST_ERROR(!xfs_agi_verify(bp), mp,
1577 1576 XFS_ERRTAG_IALLOC_READ_AGI,
1578 if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IALLOC_READ_AGI, 1577 XFS_RANDOM_IALLOC_READ_AGI))
1579 XFS_RANDOM_IALLOC_READ_AGI))) {
1580 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr);
1581 xfs_buf_ioerror(bp, EFSCORRUPTED); 1578 xfs_buf_ioerror(bp, EFSCORRUPTED);
1582 } 1579
1580 if (bp->b_error)
1581 xfs_verifier_error(bp);
1583} 1582}
1584 1583
1585static void 1584static void
@@ -1590,8 +1589,8 @@ xfs_agi_write_verify(
1590 struct xfs_buf_log_item *bip = bp->b_fspriv; 1589 struct xfs_buf_log_item *bip = bp->b_fspriv;
1591 1590
1592 if (!xfs_agi_verify(bp)) { 1591 if (!xfs_agi_verify(bp)) {
1593 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr);
1594 xfs_buf_ioerror(bp, EFSCORRUPTED); 1592 xfs_buf_ioerror(bp, EFSCORRUPTED);
1593 xfs_verifier_error(bp);
1595 return; 1594 return;
1596 } 1595 }
1597 1596
@@ -1600,8 +1599,7 @@ xfs_agi_write_verify(
1600 1599
1601 if (bip) 1600 if (bip)
1602 XFS_BUF_TO_AGI(bp)->agi_lsn = cpu_to_be64(bip->bli_item.li_lsn); 1601 XFS_BUF_TO_AGI(bp)->agi_lsn = cpu_to_be64(bip->bli_item.li_lsn);
1603 xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length), 1602 xfs_buf_update_cksum(bp, XFS_AGI_CRC_OFF);
1604 offsetof(struct xfs_agi, agi_crc));
1605} 1603}
1606 1604
1607const struct xfs_buf_ops xfs_agi_buf_ops = { 1605const struct xfs_buf_ops xfs_agi_buf_ops = {