diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-01-08 10:51:03 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-01-08 10:54:46 -0800 |
commit | a6a781a58befcbd467ce843af4eaca3906aa1f08 (patch) | |
tree | bedfef097b297a560363f8471fca0f9c3f3049dd /fs/xfs/libxfs/xfs_attr_leaf.c | |
parent | 31ca03c92c329525ee3a97d99c47f1ebbaed5d63 (diff) | |
download | blackbird-op-linux-a6a781a58befcbd467ce843af4eaca3906aa1f08.tar.gz blackbird-op-linux-a6a781a58befcbd467ce843af4eaca3906aa1f08.zip |
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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_attr_leaf.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr_leaf.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 6a9805ad95cb..f6281e100469 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -247,7 +247,7 @@ xfs_attr3_leaf_hdr_to_disk( } } -static bool +static xfs_failaddr_t xfs_attr3_leaf_verify( struct xfs_buf *bp) { @@ -262,17 +262,17 @@ xfs_attr3_leaf_verify( struct xfs_da3_node_hdr *hdr3 = bp->b_addr; if (ichdr.magic != XFS_ATTR3_LEAF_MAGIC) - return false; + return __this_address; if (!uuid_equal(&hdr3->info.uuid, &mp->m_sb.sb_meta_uuid)) - return false; + return __this_address; if (be64_to_cpu(hdr3->info.blkno) != bp->b_bn) - return false; + return __this_address; if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->info.lsn))) - return false; + return __this_address; } else { if (ichdr.magic != XFS_ATTR_LEAF_MAGIC) - return false; + return __this_address; } /* * In recovery there is a transient state where count == 0 is valid @@ -280,12 +280,12 @@ xfs_attr3_leaf_verify( * if the attr didn't fit in shortform. */ if (pag && pag->pagf_init && ichdr.count == 0) - return false; + return __this_address; /* XXX: need to range check rest of attr header values */ /* XXX: hash order check? */ - return true; + return NULL; } static void @@ -296,7 +296,7 @@ xfs_attr3_leaf_write_verify( struct xfs_buf_log_item *bip = bp->b_fspriv; struct xfs_attr3_leaf_hdr *hdr3 = bp->b_addr; - if (!xfs_attr3_leaf_verify(bp)) { + if (xfs_attr3_leaf_verify(bp)) { xfs_verifier_error(bp, -EFSCORRUPTED); return; } @@ -325,7 +325,7 @@ xfs_attr3_leaf_read_verify( 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)) + else if (xfs_attr3_leaf_verify(bp)) xfs_verifier_error(bp, -EFSCORRUPTED); } |