diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-01-08 21:51:02 +0300 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-01-08 21:54:45 +0300 |
commit | 31ca03c92c329525ee3a97d99c47f1ebbaed5d63 (patch) | |
tree | f5f9b0e55afa1e6362411df8461d659a3933cd73 /fs/xfs/libxfs/xfs_attr_remote.c | |
parent | 9101d3707b9acae8bbb0d82d47e99cf5c60b3ee5 (diff) | |
download | linux-31ca03c92c329525ee3a97d99c47f1ebbaed5d63.tar.xz |
xfs: refactor xfs_verifier_error and xfs_buf_ioerror
Since all verification errors also mark the buffer as having an error,
we can combine these two calls. Later we'll add a xfs_failaddr_t
parameter to promote the idea of reporting corruption errors and the
address of the failing check to enable better debugging reports.
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_remote.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr_remote.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index d56caf037ca0..231b569bb230 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -137,22 +137,20 @@ xfs_attr3_rmt_read_verify( while (len > 0) { if (!xfs_verify_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF)) { - xfs_buf_ioerror(bp, -EFSBADCRC); - break; + xfs_verifier_error(bp, -EFSBADCRC); + return; } if (!xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) { - xfs_buf_ioerror(bp, -EFSCORRUPTED); - break; + xfs_verifier_error(bp, -EFSCORRUPTED); + return; } len -= blksize; ptr += blksize; bno += BTOBB(blksize); } - if (bp->b_error) - xfs_verifier_error(bp); - else - ASSERT(len == 0); + if (len != 0) + xfs_verifier_error(bp, -EFSCORRUPTED); } static void @@ -178,8 +176,7 @@ xfs_attr3_rmt_write_verify( struct xfs_attr3_rmt_hdr *rmt = (struct xfs_attr3_rmt_hdr *)ptr; if (!xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) { - xfs_buf_ioerror(bp, -EFSCORRUPTED); - xfs_verifier_error(bp); + xfs_verifier_error(bp, -EFSCORRUPTED); return; } @@ -188,8 +185,7 @@ xfs_attr3_rmt_write_verify( * xfs_attr3_rmt_hdr_set() for the explanation. */ if (rmt->rm_lsn != cpu_to_be64(NULLCOMMITLSN)) { - xfs_buf_ioerror(bp, -EFSCORRUPTED); - xfs_verifier_error(bp); + xfs_verifier_error(bp, -EFSCORRUPTED); return; } xfs_update_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF); @@ -198,7 +194,9 @@ xfs_attr3_rmt_write_verify( ptr += blksize; bno += BTOBB(blksize); } - ASSERT(len == 0); + + if (len != 0) + xfs_verifier_error(bp, -EFSCORRUPTED); } const struct xfs_buf_ops xfs_attr3_rmt_buf_ops = { |