diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-02-26 22:43:17 -0600 |
---|---|---|
committer | Eric Sandeen <sandeen@redhat.com> | 2018-02-26 22:43:17 -0600 |
commit | 1e697959c36552580795dc81f9697fb9681c63b7 (patch) | |
tree | 041866f38cd643c542d7133a3db7af8eac332d45 | |
parent | bc01119d6b2856bfdcab45efdcdcedb19cb517fc (diff) | |
download | xfsprogs-dev-1e697959c36552580795dc81f9697fb9681c63b7.tar.gz |
xfs: refactor verifier callers to print address of failing check
Source kernel commit: bc1a09b8e334bf5fca1d6727aec538dcff957961
Refactor the callers of verifiers to print the instruction address of a
failing check.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r-- | libxfs/libxfs_priv.h | 2 | ||||
-rw-r--r-- | libxfs/util.c | 6 | ||||
-rw-r--r-- | libxfs/xfs_alloc.c | 33 | ||||
-rw-r--r-- | libxfs/xfs_alloc_btree.c | 18 | ||||
-rw-r--r-- | libxfs/xfs_attr_leaf.c | 16 | ||||
-rw-r--r-- | libxfs/xfs_attr_remote.c | 22 | ||||
-rw-r--r-- | libxfs/xfs_bmap_btree.c | 18 | ||||
-rw-r--r-- | libxfs/xfs_da_btree.c | 17 | ||||
-rw-r--r-- | libxfs/xfs_dir2_block.c | 16 | ||||
-rw-r--r-- | libxfs/xfs_dir2_data.c | 18 | ||||
-rw-r--r-- | libxfs/xfs_dir2_leaf.c | 16 | ||||
-rw-r--r-- | libxfs/xfs_dir2_node.c | 24 | ||||
-rw-r--r-- | libxfs/xfs_dquot_buf.c | 6 | ||||
-rw-r--r-- | libxfs/xfs_ialloc.c | 17 | ||||
-rw-r--r-- | libxfs/xfs_ialloc_btree.c | 18 | ||||
-rw-r--r-- | libxfs/xfs_inode_buf.c | 2 | ||||
-rw-r--r-- | libxfs/xfs_refcount_btree.c | 18 | ||||
-rw-r--r-- | libxfs/xfs_rmap_btree.c | 18 | ||||
-rw-r--r-- | libxfs/xfs_sb.c | 4 | ||||
-rw-r--r-- | libxfs/xfs_symlink_remote.c | 16 |
20 files changed, 205 insertions, 100 deletions
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 029740ac7b..eef344bb51 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -494,7 +494,7 @@ int libxfs_mod_incore_sb(struct xfs_mount *, int, int64_t, int); #define xfs_reinit_percpu_counters(mp) void xfs_trans_mod_sb(struct xfs_trans *, uint, long); -void xfs_verifier_error(struct xfs_buf *bp, int error); +void xfs_verifier_error(struct xfs_buf *bp, int error, xfs_failaddr_t failaddr); /* XXX: this is clearly a bug - a shared header needs to export this */ /* xfs_rtalloc.c */ diff --git a/libxfs/util.c b/libxfs/util.c index 9653abb420..f6ce3949d8 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -734,12 +734,14 @@ cmn_err(int level, char *fmt, ...) void xfs_verifier_error( struct xfs_buf *bp, - int error) + int error, + xfs_failaddr_t failaddr) { xfs_buf_ioerror(bp, error); - xfs_alert(NULL, "Metadata %s detected at %s block 0x%llx/0x%x", + xfs_alert(NULL, "Metadata %s detected at %p, %s block 0x%llx/0x%x", bp->b_error == -EFSBADCRC ? "CRC error" : "corruption", + failaddr ? failaddr : __return_address, bp->b_ops->name, bp->b_bn, BBTOB(bp->b_length)); } diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 88377dfe7d..1e2470793a 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -553,6 +553,7 @@ xfs_agfl_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; /* * There is no verification of non-crc AGFLs because mkfs does not @@ -564,9 +565,12 @@ xfs_agfl_read_verify( return; if (!xfs_buf_verify_cksum(bp, XFS_AGFL_CRC_OFF)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_agfl_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_agfl_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } static void @@ -575,13 +579,15 @@ xfs_agfl_write_verify( { struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; + xfs_failaddr_t fa; /* no verification of non-crc AGFLs */ if (!xfs_sb_version_hascrc(&mp->m_sb)) return; - if (xfs_agfl_verify(bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_agfl_verify(bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } @@ -2451,13 +2457,16 @@ xfs_agf_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_AGF_CRC_OFF)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (XFS_TEST_ERROR(xfs_agf_verify(mp, bp), mp, - XFS_ERRTAG_ALLOC_READ_AGF)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_agf_verify(mp, bp); + if (XFS_TEST_ERROR(fa, mp, XFS_ERRTAG_ALLOC_READ_AGF)) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } static void @@ -2466,9 +2475,11 @@ xfs_agf_write_verify( { struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; + xfs_failaddr_t fa; - if (xfs_agf_verify(mp, bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_agf_verify(mp, bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c index e3763e84ac..e3a3d4aa1b 100644 --- a/libxfs/xfs_alloc_btree.c +++ b/libxfs/xfs_alloc_btree.c @@ -364,10 +364,15 @@ static void xfs_allocbt_read_verify( struct xfs_buf *bp) { + xfs_failaddr_t fa; + if (!xfs_btree_sblock_verify_crc(bp)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_allocbt_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_allocbt_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } if (bp->b_error) trace_xfs_btree_corrupt(bp, _RET_IP_); @@ -377,9 +382,12 @@ static void xfs_allocbt_write_verify( struct xfs_buf *bp) { - if (xfs_allocbt_verify(bp)) { + xfs_failaddr_t fa; + + fa = xfs_allocbt_verify(bp); + if (fa) { trace_xfs_btree_corrupt(bp, _RET_IP_); - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } xfs_btree_sblock_calc_crc(bp); diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 23718bc3fa..ead3e71cc9 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -290,9 +290,11 @@ xfs_attr3_leaf_write_verify( struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; struct xfs_attr3_leaf_hdr *hdr3 = bp->b_addr; + xfs_failaddr_t fa; - if (xfs_attr3_leaf_verify(bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_attr3_leaf_verify(bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } @@ -316,12 +318,16 @@ xfs_attr3_leaf_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_ATTR3_LEAF_CRC_OFF)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_attr3_leaf_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_attr3_leaf_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } const struct xfs_buf_ops xfs_attr3_leaf_buf_ops = { diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index 0c4f728b03..cff9d79545 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -117,6 +117,7 @@ xfs_attr3_rmt_read_verify( { struct xfs_mount *mp = bp->b_target->bt_mount; char *ptr; + xfs_failaddr_t fa; int len; xfs_daddr_t bno; int blksize = mp->m_attr_geo->blksize; @@ -132,12 +133,13 @@ xfs_attr3_rmt_read_verify( while (len > 0) { if (!xfs_verify_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF)) { - xfs_verifier_error(bp, -EFSBADCRC); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); return; } - if (xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) { - xfs_verifier_error(bp, -EFSCORRUPTED); - return; + fa = xfs_attr3_rmt_verify(mp, ptr, blksize, bno); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + break; } len -= blksize; ptr += blksize; @@ -145,7 +147,7 @@ xfs_attr3_rmt_read_verify( } if (len != 0) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, __this_address); } static void @@ -153,6 +155,7 @@ xfs_attr3_rmt_write_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; int blksize = mp->m_attr_geo->blksize; char *ptr; int len; @@ -170,8 +173,9 @@ xfs_attr3_rmt_write_verify( while (len > 0) { struct xfs_attr3_rmt_hdr *rmt = (struct xfs_attr3_rmt_hdr *)ptr; - if (xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_attr3_rmt_verify(mp, ptr, blksize, bno); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } @@ -180,7 +184,7 @@ xfs_attr3_rmt_write_verify( * xfs_attr3_rmt_hdr_set() for the explanation. */ if (rmt->rm_lsn != cpu_to_be64(NULLCOMMITLSN)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, __this_address); return; } xfs_update_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF); @@ -191,7 +195,7 @@ xfs_attr3_rmt_write_verify( } if (len != 0) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, __this_address); } const struct xfs_buf_ops xfs_attr3_rmt_buf_ops = { diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c index 9b4724e466..2c1b0bd582 100644 --- a/libxfs/xfs_bmap_btree.c +++ b/libxfs/xfs_bmap_btree.c @@ -465,10 +465,15 @@ static void xfs_bmbt_read_verify( struct xfs_buf *bp) { + xfs_failaddr_t fa; + if (!xfs_btree_lblock_verify_crc(bp)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_bmbt_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_bmbt_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } if (bp->b_error) trace_xfs_btree_corrupt(bp, _RET_IP_); @@ -478,9 +483,12 @@ static void xfs_bmbt_write_verify( struct xfs_buf *bp) { - if (xfs_bmbt_verify(bp)) { + xfs_failaddr_t fa; + + fa = xfs_bmbt_verify(bp); + if (fa) { trace_xfs_btree_corrupt(bp, _RET_IP_); - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } xfs_btree_lblock_calc_crc(bp); diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index de11049f98..2027b0f74b 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -179,9 +179,11 @@ xfs_da3_node_write_verify( struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; struct xfs_da3_node_hdr *hdr3 = bp->b_addr; + xfs_failaddr_t fa; - if (xfs_da3_node_verify(bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_da3_node_verify(bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } @@ -205,17 +207,20 @@ xfs_da3_node_read_verify( struct xfs_buf *bp) { struct xfs_da_blkinfo *info = bp->b_addr; + xfs_failaddr_t fa; switch (be16_to_cpu(info->magic)) { case XFS_DA3_NODE_MAGIC: if (!xfs_buf_verify_cksum(bp, XFS_DA3_NODE_CRC_OFF)) { - xfs_verifier_error(bp, -EFSBADCRC); + xfs_verifier_error(bp, -EFSBADCRC, + __this_address); break; } /* fall through */ case XFS_DA_NODE_MAGIC: - if (xfs_da3_node_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_da3_node_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; case XFS_ATTR_LEAF_MAGIC: case XFS_ATTR3_LEAF_MAGIC: @@ -228,7 +233,7 @@ xfs_da3_node_read_verify( bp->b_ops->verify_read(bp); return; default: - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, __this_address); break; } } diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index 6f6eec302a..765fba143d 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -82,12 +82,16 @@ xfs_dir3_block_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_DIR3_DATA_CRC_OFF)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_dir3_block_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_dir3_block_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } static void @@ -97,9 +101,11 @@ xfs_dir3_block_write_verify( struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; + xfs_failaddr_t fa; - if (xfs_dir3_block_verify(bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_dir3_block_verify(bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index 3e6d068387..6099cff304 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -281,7 +281,7 @@ xfs_dir3_data_reada_verify( bp->b_ops->verify_read(bp); return; default: - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, __this_address); break; } } @@ -291,12 +291,16 @@ xfs_dir3_data_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_DIR3_DATA_CRC_OFF)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_dir3_data_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_dir3_data_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } static void @@ -306,9 +310,11 @@ xfs_dir3_data_write_verify( struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; + xfs_failaddr_t fa; - if (xfs_dir3_data_verify(bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_dir3_data_verify(bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c index 038d0c425f..4c76f84483 100644 --- a/libxfs/xfs_dir2_leaf.c +++ b/libxfs/xfs_dir2_leaf.c @@ -187,12 +187,16 @@ __read_verify( uint16_t magic) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_DIR3_LEAF_CRC_OFF)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_dir3_leaf_verify(bp, magic)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_dir3_leaf_verify(bp, magic); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } static void @@ -203,9 +207,11 @@ __write_verify( struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr; + xfs_failaddr_t fa; - if (xfs_dir3_leaf_verify(bp, magic)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_dir3_leaf_verify(bp, magic); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index 954bba3798..c5ef0b54a3 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -121,12 +121,16 @@ xfs_dir3_free_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; if (xfs_sb_version_hascrc(&mp->m_sb) && !xfs_buf_verify_cksum(bp, XFS_DIR3_FREE_CRC_OFF)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_dir3_free_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_dir3_free_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } static void @@ -136,9 +140,11 @@ xfs_dir3_free_write_verify( struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; + xfs_failaddr_t fa; - if (xfs_dir3_free_verify(bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_dir3_free_verify(bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } @@ -158,7 +164,7 @@ const struct xfs_buf_ops xfs_dir3_free_buf_ops = { }; /* Everything ok in the free block header? */ -static bool +static xfs_failaddr_t xfs_dir3_free_header_check( struct xfs_inode *dp, xfs_dablk_t fbno, @@ -202,6 +208,7 @@ __xfs_dir3_free_read( xfs_daddr_t mappedbno, struct xfs_buf **bpp) { + xfs_failaddr_t fa; int err; err = xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp, @@ -210,8 +217,9 @@ __xfs_dir3_free_read( return err; /* Check things that we can't do in the verifier. */ - if (xfs_dir3_free_header_check(dp, fbno, *bpp)) { - xfs_verifier_error(*bpp, -EFSCORRUPTED); + fa = xfs_dir3_free_header_check(dp, fbno, *bpp); + if (fa) { + xfs_verifier_error(*bpp, -EFSCORRUPTED, fa); xfs_trans_brelse(tp, *bpp); return -EFSCORRUPTED; } diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c index 3b69788abd..2dcf5c018d 100644 --- a/libxfs/xfs_dquot_buf.c +++ b/libxfs/xfs_dquot_buf.c @@ -247,9 +247,9 @@ xfs_dquot_buf_read_verify( struct xfs_mount *mp = bp->b_target->bt_mount; if (!xfs_dquot_buf_verify_crc(mp, bp)) - xfs_verifier_error(bp, -EFSBADCRC); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); else if (!xfs_dquot_buf_verify(mp, bp, XFS_QMOPT_DOWARN)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, __this_address); } /* @@ -283,7 +283,7 @@ xfs_dquot_buf_write_verify( struct xfs_mount *mp = bp->b_target->bt_mount; if (!xfs_dquot_buf_verify(mp, bp, XFS_QMOPT_DOWARN)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, __this_address); return; } } diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index e092a6015a..6d66440f7a 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -2535,13 +2535,16 @@ xfs_agi_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; 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, - XFS_ERRTAG_IALLOC_READ_AGI)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_agi_verify(bp); + if (XFS_TEST_ERROR(fa, mp, XFS_ERRTAG_IALLOC_READ_AGI)) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } static void @@ -2550,9 +2553,11 @@ xfs_agi_write_verify( { struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; + xfs_failaddr_t fa; - if (xfs_agi_verify(bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_agi_verify(bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } diff --git a/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c index f5044523d8..ea8ca12d80 100644 --- a/libxfs/xfs_ialloc_btree.c +++ b/libxfs/xfs_ialloc_btree.c @@ -294,10 +294,15 @@ static void xfs_inobt_read_verify( struct xfs_buf *bp) { + xfs_failaddr_t fa; + if (!xfs_btree_sblock_verify_crc(bp)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_inobt_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_inobt_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } if (bp->b_error) trace_xfs_btree_corrupt(bp, _RET_IP_); @@ -307,9 +312,12 @@ static void xfs_inobt_write_verify( struct xfs_buf *bp) { - if (xfs_inobt_verify(bp)) { + xfs_failaddr_t fa; + + fa = xfs_inobt_verify(bp); + if (fa) { trace_xfs_btree_corrupt(bp, _RET_IP_); - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } xfs_btree_sblock_calc_crc(bp); diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 3cdabd5897..e82e56d922 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -111,7 +111,7 @@ xfs_inode_buf_verify( return; } - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, __this_address); #ifdef DEBUG xfs_alert(mp, "bad inode magic/vsn daddr %lld #%d (magic=%x)", diff --git a/libxfs/xfs_refcount_btree.c b/libxfs/xfs_refcount_btree.c index 4f6f7bba7e..dd3b4d6a2b 100644 --- a/libxfs/xfs_refcount_btree.c +++ b/libxfs/xfs_refcount_btree.c @@ -255,10 +255,15 @@ STATIC void xfs_refcountbt_read_verify( struct xfs_buf *bp) { + xfs_failaddr_t fa; + if (!xfs_btree_sblock_verify_crc(bp)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_refcountbt_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_refcountbt_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } if (bp->b_error) trace_xfs_btree_corrupt(bp, _RET_IP_); @@ -268,9 +273,12 @@ STATIC void xfs_refcountbt_write_verify( struct xfs_buf *bp) { - if (xfs_refcountbt_verify(bp)) { + xfs_failaddr_t fa; + + fa = xfs_refcountbt_verify(bp); + if (fa) { trace_xfs_btree_corrupt(bp, _RET_IP_); - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } xfs_btree_sblock_calc_crc(bp); diff --git a/libxfs/xfs_rmap_btree.c b/libxfs/xfs_rmap_btree.c index 0ba0b44183..1a2d908430 100644 --- a/libxfs/xfs_rmap_btree.c +++ b/libxfs/xfs_rmap_btree.c @@ -346,10 +346,15 @@ static void xfs_rmapbt_read_verify( struct xfs_buf *bp) { + xfs_failaddr_t fa; + if (!xfs_btree_sblock_verify_crc(bp)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_rmapbt_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_rmapbt_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } if (bp->b_error) trace_xfs_btree_corrupt(bp, _RET_IP_); @@ -359,9 +364,12 @@ static void xfs_rmapbt_write_verify( struct xfs_buf *bp) { - if (xfs_rmapbt_verify(bp)) { + xfs_failaddr_t fa; + + fa = xfs_rmapbt_verify(bp); + if (fa) { trace_xfs_btree_corrupt(bp, _RET_IP_); - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } xfs_btree_sblock_calc_crc(bp); diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c index ce828c2a5b..a339a84bdb 100644 --- a/libxfs/xfs_sb.c +++ b/libxfs/xfs_sb.c @@ -623,7 +623,7 @@ xfs_sb_read_verify( out_error: if (error == -EFSCORRUPTED || error == -EFSBADCRC) - xfs_verifier_error(bp, error); + xfs_verifier_error(bp, error, __this_address); else if (error) xfs_buf_ioerror(bp, error); } @@ -659,7 +659,7 @@ xfs_sb_write_verify( error = xfs_sb_verify(bp, false); if (error) { - xfs_verifier_error(bp, error); + xfs_verifier_error(bp, error, __this_address); return; } diff --git a/libxfs/xfs_symlink_remote.c b/libxfs/xfs_symlink_remote.c index 67c1e3467e..ff61d32941 100644 --- a/libxfs/xfs_symlink_remote.c +++ b/libxfs/xfs_symlink_remote.c @@ -125,15 +125,19 @@ xfs_symlink_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; + xfs_failaddr_t fa; /* no verification of non-crc buffers */ if (!xfs_sb_version_hascrc(&mp->m_sb)) return; if (!xfs_buf_verify_cksum(bp, XFS_SYMLINK_CRC_OFF)) - xfs_verifier_error(bp, -EFSBADCRC); - else if (xfs_symlink_verify(bp)) - xfs_verifier_error(bp, -EFSCORRUPTED); + xfs_verifier_error(bp, -EFSBADCRC, __this_address); + else { + fa = xfs_symlink_verify(bp); + if (fa) + xfs_verifier_error(bp, -EFSCORRUPTED, fa); + } } static void @@ -142,13 +146,15 @@ xfs_symlink_write_verify( { struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; + xfs_failaddr_t fa; /* no verification of non-crc buffers */ if (!xfs_sb_version_hascrc(&mp->m_sb)) return; - if (xfs_symlink_verify(bp)) { - xfs_verifier_error(bp, -EFSCORRUPTED); + fa = xfs_symlink_verify(bp); + if (fa) { + xfs_verifier_error(bp, -EFSCORRUPTED, fa); return; } |