aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_alloc.c')
-rw-r--r--fs/xfs/xfs_alloc.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 9c7cf3d060a6..c1cf6a336a72 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -474,7 +474,6 @@ xfs_agfl_read_verify(
474 struct xfs_buf *bp) 474 struct xfs_buf *bp)
475{ 475{
476 struct xfs_mount *mp = bp->b_target->bt_mount; 476 struct xfs_mount *mp = bp->b_target->bt_mount;
477 int agfl_ok = 1;
478 477
479 /* 478 /*
480 * There is no verification of non-crc AGFLs because mkfs does not 479 * There is no verification of non-crc AGFLs because mkfs does not
@@ -485,14 +484,13 @@ xfs_agfl_read_verify(
485 if (!xfs_sb_version_hascrc(&mp->m_sb)) 484 if (!xfs_sb_version_hascrc(&mp->m_sb))
486 return; 485 return;
487 486
488 agfl_ok = xfs_buf_verify_cksum(bp, XFS_AGFL_CRC_OFF); 487 if (!xfs_buf_verify_cksum(bp, XFS_AGFL_CRC_OFF))
489 488 xfs_buf_ioerror(bp, EFSBADCRC);
490 agfl_ok = agfl_ok && xfs_agfl_verify(bp); 489 else if (!xfs_agfl_verify(bp))
491
492 if (!agfl_ok) {
493 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr);
494 xfs_buf_ioerror(bp, EFSCORRUPTED); 490 xfs_buf_ioerror(bp, EFSCORRUPTED);
495 } 491
492 if (bp->b_error)
493 xfs_verifier_error(bp);
496} 494}
497 495
498static void 496static void
@@ -507,8 +505,8 @@ xfs_agfl_write_verify(
507 return; 505 return;
508 506
509 if (!xfs_agfl_verify(bp)) { 507 if (!xfs_agfl_verify(bp)) {
510 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr);
511 xfs_buf_ioerror(bp, EFSCORRUPTED); 508 xfs_buf_ioerror(bp, EFSCORRUPTED);
509 xfs_verifier_error(bp);
512 return; 510 return;
513 } 511 }
514 512
@@ -2236,18 +2234,17 @@ xfs_agf_read_verify(
2236 struct xfs_buf *bp) 2234 struct xfs_buf *bp)
2237{ 2235{
2238 struct xfs_mount *mp = bp->b_target->bt_mount; 2236 struct xfs_mount *mp = bp->b_target->bt_mount;
2239 int agf_ok = 1;
2240
2241 if (xfs_sb_version_hascrc(&mp->m_sb))
2242 agf_ok = xfs_buf_verify_cksum(bp, XFS_AGF_CRC_OFF);
2243 2237
2244 agf_ok = agf_ok && xfs_agf_verify(mp, bp); 2238 if (xfs_sb_version_hascrc(&mp->m_sb) &&
2245 2239 !xfs_buf_verify_cksum(bp, XFS_AGF_CRC_OFF))
2246 if (unlikely(XFS_TEST_ERROR(!agf_ok, mp, XFS_ERRTAG_ALLOC_READ_AGF, 2240 xfs_buf_ioerror(bp, EFSBADCRC);
2247 XFS_RANDOM_ALLOC_READ_AGF))) { 2241 else if (XFS_TEST_ERROR(!xfs_agf_verify(mp, bp), mp,
2248 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr); 2242 XFS_ERRTAG_ALLOC_READ_AGF,
2243 XFS_RANDOM_ALLOC_READ_AGF))
2249 xfs_buf_ioerror(bp, EFSCORRUPTED); 2244 xfs_buf_ioerror(bp, EFSCORRUPTED);
2250 } 2245
2246 if (bp->b_error)
2247 xfs_verifier_error(bp);
2251} 2248}
2252 2249
2253static void 2250static void
@@ -2258,8 +2255,8 @@ xfs_agf_write_verify(
2258 struct xfs_buf_log_item *bip = bp->b_fspriv; 2255 struct xfs_buf_log_item *bip = bp->b_fspriv;
2259 2256
2260 if (!xfs_agf_verify(mp, bp)) { 2257 if (!xfs_agf_verify(mp, bp)) {
2261 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr);
2262 xfs_buf_ioerror(bp, EFSCORRUPTED); 2258 xfs_buf_ioerror(bp, EFSCORRUPTED);
2259 xfs_verifier_error(bp);
2263 return; 2260 return;
2264 } 2261 }
2265 2262