xfs: convert open coded corruption check to use XFS_IS_CORRUPT
Convert the last of the open coded corruption check and report idioms to use the XFS_IS_CORRUPT macro. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
f9e0370648
commit
a71895c5da
|
@ -1071,8 +1071,7 @@ xfs_alloc_ag_vextent_small(
|
||||||
struct xfs_buf *bp;
|
struct xfs_buf *bp;
|
||||||
|
|
||||||
bp = xfs_btree_get_bufs(args->mp, args->tp, args->agno, fbno);
|
bp = xfs_btree_get_bufs(args->mp, args->tp, args->agno, fbno);
|
||||||
if (!bp) {
|
if (XFS_IS_CORRUPT(args->mp, !bp)) {
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, args->mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -2341,10 +2340,8 @@ xfs_free_agfl_block(
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
bp = xfs_btree_get_bufs(tp->t_mountp, tp, agno, agbno);
|
bp = xfs_btree_get_bufs(tp->t_mountp, tp, agno, agbno);
|
||||||
if (!bp) {
|
if (XFS_IS_CORRUPT(tp->t_mountp, !bp))
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, tp->t_mountp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
xfs_trans_binval(tp, bp);
|
xfs_trans_binval(tp, bp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -731,8 +731,7 @@ xfs_bmap_extents_to_btree(
|
||||||
ip->i_d.di_nblocks++;
|
ip->i_d.di_nblocks++;
|
||||||
xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L);
|
xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L);
|
||||||
abp = xfs_btree_get_bufl(mp, tp, args.fsbno);
|
abp = xfs_btree_get_bufl(mp, tp, args.fsbno);
|
||||||
if (!abp) {
|
if (XFS_IS_CORRUPT(mp, !abp)) {
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out_unreserve_dquot;
|
goto out_unreserve_dquot;
|
||||||
}
|
}
|
||||||
|
@ -1090,8 +1089,7 @@ xfs_bmap_add_attrfork(
|
||||||
goto trans_cancel;
|
goto trans_cancel;
|
||||||
if (XFS_IFORK_Q(ip))
|
if (XFS_IFORK_Q(ip))
|
||||||
goto trans_cancel;
|
goto trans_cancel;
|
||||||
if (ip->i_d.di_anextents != 0) {
|
if (XFS_IS_CORRUPT(mp, ip->i_d.di_anextents != 0)) {
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto trans_cancel;
|
goto trans_cancel;
|
||||||
}
|
}
|
||||||
|
@ -1238,8 +1236,9 @@ xfs_iread_extents(
|
||||||
|
|
||||||
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
|
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
|
||||||
|
|
||||||
if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) {
|
if (XFS_IS_CORRUPT(mp,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
XFS_IFORK_FORMAT(ip, whichfork) !=
|
||||||
|
XFS_DINODE_FMT_BTREE)) {
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1253,8 +1252,8 @@ xfs_iread_extents(
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (ir.loaded != XFS_IFORK_NEXTENTS(ip, whichfork)) {
|
if (XFS_IS_CORRUPT(mp,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
ir.loaded != XFS_IFORK_NEXTENTS(ip, whichfork))) {
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1444,10 +1443,8 @@ xfs_bmap_last_offset(
|
||||||
if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL)
|
if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!xfs_ifork_has_extents(ip, whichfork)) {
|
if (XFS_IS_CORRUPT(ip->i_mount, !xfs_ifork_has_extents(ip, whichfork)))
|
||||||
ASSERT(0);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
|
|
||||||
error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty);
|
error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty);
|
||||||
if (error || is_empty)
|
if (error || is_empty)
|
||||||
|
@ -3906,10 +3903,8 @@ xfs_bmapi_read(
|
||||||
XFS_BMAPI_COWFORK)));
|
XFS_BMAPI_COWFORK)));
|
||||||
ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED|XFS_ILOCK_EXCL));
|
ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED|XFS_ILOCK_EXCL));
|
||||||
|
|
||||||
if (unlikely(XFS_TEST_ERROR(
|
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ip, whichfork)) ||
|
||||||
!xfs_ifork_has_extents(ip, whichfork),
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT)) {
|
||||||
mp, XFS_ERRTAG_BMAPIFORMAT))) {
|
|
||||||
XFS_ERROR_REPORT("xfs_bmapi_read", XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4417,10 +4412,8 @@ xfs_bmapi_write(
|
||||||
ASSERT((flags & (XFS_BMAPI_PREALLOC | XFS_BMAPI_ZERO)) !=
|
ASSERT((flags & (XFS_BMAPI_PREALLOC | XFS_BMAPI_ZERO)) !=
|
||||||
(XFS_BMAPI_PREALLOC | XFS_BMAPI_ZERO));
|
(XFS_BMAPI_PREALLOC | XFS_BMAPI_ZERO));
|
||||||
|
|
||||||
if (unlikely(XFS_TEST_ERROR(
|
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ip, whichfork)) ||
|
||||||
!xfs_ifork_has_extents(ip, whichfork),
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT)) {
|
||||||
mp, XFS_ERRTAG_BMAPIFORMAT))) {
|
|
||||||
XFS_ERROR_REPORT("xfs_bmapi_write", XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4686,10 +4679,8 @@ xfs_bmapi_remap(
|
||||||
ASSERT((flags & (XFS_BMAPI_ATTRFORK | XFS_BMAPI_PREALLOC)) !=
|
ASSERT((flags & (XFS_BMAPI_ATTRFORK | XFS_BMAPI_PREALLOC)) !=
|
||||||
(XFS_BMAPI_ATTRFORK | XFS_BMAPI_PREALLOC));
|
(XFS_BMAPI_ATTRFORK | XFS_BMAPI_PREALLOC));
|
||||||
|
|
||||||
if (unlikely(XFS_TEST_ERROR(
|
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ip, whichfork)) ||
|
||||||
!xfs_ifork_has_extents(ip, whichfork),
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT)) {
|
||||||
mp, XFS_ERRTAG_BMAPIFORMAT))) {
|
|
||||||
XFS_ERROR_REPORT("xfs_bmapi_remap", XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5311,7 +5302,7 @@ __xfs_bunmapi(
|
||||||
int isrt; /* freeing in rt area */
|
int isrt; /* freeing in rt area */
|
||||||
int logflags; /* transaction logging flags */
|
int logflags; /* transaction logging flags */
|
||||||
xfs_extlen_t mod; /* rt extent offset */
|
xfs_extlen_t mod; /* rt extent offset */
|
||||||
struct xfs_mount *mp; /* mount structure */
|
struct xfs_mount *mp = ip->i_mount;
|
||||||
int tmp_logflags; /* partial logging flags */
|
int tmp_logflags; /* partial logging flags */
|
||||||
int wasdel; /* was a delayed alloc extent */
|
int wasdel; /* was a delayed alloc extent */
|
||||||
int whichfork; /* data or attribute fork */
|
int whichfork; /* data or attribute fork */
|
||||||
|
@ -5328,12 +5319,8 @@ __xfs_bunmapi(
|
||||||
whichfork = xfs_bmapi_whichfork(flags);
|
whichfork = xfs_bmapi_whichfork(flags);
|
||||||
ASSERT(whichfork != XFS_COW_FORK);
|
ASSERT(whichfork != XFS_COW_FORK);
|
||||||
ifp = XFS_IFORK_PTR(ip, whichfork);
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
||||||
if (unlikely(!xfs_ifork_has_extents(ip, whichfork))) {
|
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ip, whichfork)))
|
||||||
XFS_ERROR_REPORT("xfs_bunmapi", XFS_ERRLEVEL_LOW,
|
|
||||||
ip->i_mount);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
mp = ip->i_mount;
|
|
||||||
if (XFS_FORCED_SHUTDOWN(mp))
|
if (XFS_FORCED_SHUTDOWN(mp))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
@ -5826,10 +5813,8 @@ xfs_bmap_collapse_extents(
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int logflags = 0;
|
int logflags = 0;
|
||||||
|
|
||||||
if (unlikely(XFS_TEST_ERROR(
|
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ip, whichfork)) ||
|
||||||
!xfs_ifork_has_extents(ip, whichfork),
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT)) {
|
||||||
mp, XFS_ERRTAG_BMAPIFORMAT))) {
|
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5945,10 +5930,8 @@ xfs_bmap_insert_extents(
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int logflags = 0;
|
int logflags = 0;
|
||||||
|
|
||||||
if (unlikely(XFS_TEST_ERROR(
|
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ip, whichfork)) ||
|
||||||
!xfs_ifork_has_extents(ip, whichfork),
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT)) {
|
||||||
mp, XFS_ERRTAG_BMAPIFORMAT))) {
|
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5986,8 +5969,8 @@ xfs_bmap_insert_extents(
|
||||||
goto del_cursor;
|
goto del_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stop_fsb >= got.br_startoff + got.br_blockcount) {
|
if (XFS_IS_CORRUPT(mp,
|
||||||
ASSERT(0);
|
stop_fsb >= got.br_startoff + got.br_blockcount)) {
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto del_cursor;
|
goto del_cursor;
|
||||||
}
|
}
|
||||||
|
@ -6053,11 +6036,8 @@ xfs_bmap_split_extent_at(
|
||||||
int logflags = 0;
|
int logflags = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (unlikely(XFS_TEST_ERROR(
|
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ip, whichfork)) ||
|
||||||
!xfs_ifork_has_extents(ip, whichfork),
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT)) {
|
||||||
mp, XFS_ERRTAG_BMAPIFORMAT))) {
|
|
||||||
XFS_ERROR_REPORT("xfs_bmap_split_extent_at",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,11 +105,10 @@ xfs_btree_check_lblock(
|
||||||
xfs_failaddr_t fa;
|
xfs_failaddr_t fa;
|
||||||
|
|
||||||
fa = __xfs_btree_check_lblock(cur, block, level, bp);
|
fa = __xfs_btree_check_lblock(cur, block, level, bp);
|
||||||
if (unlikely(XFS_TEST_ERROR(fa != NULL, mp,
|
if (XFS_IS_CORRUPT(mp, fa != NULL) ||
|
||||||
XFS_ERRTAG_BTREE_CHECK_LBLOCK))) {
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BTREE_CHECK_LBLOCK)) {
|
||||||
if (bp)
|
if (bp)
|
||||||
trace_xfs_btree_corrupt(bp, _RET_IP_);
|
trace_xfs_btree_corrupt(bp, _RET_IP_);
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -169,11 +168,10 @@ xfs_btree_check_sblock(
|
||||||
xfs_failaddr_t fa;
|
xfs_failaddr_t fa;
|
||||||
|
|
||||||
fa = __xfs_btree_check_sblock(cur, block, level, bp);
|
fa = __xfs_btree_check_sblock(cur, block, level, bp);
|
||||||
if (unlikely(XFS_TEST_ERROR(fa != NULL, mp,
|
if (XFS_IS_CORRUPT(mp, fa != NULL) ||
|
||||||
XFS_ERRTAG_BTREE_CHECK_SBLOCK))) {
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BTREE_CHECK_SBLOCK)) {
|
||||||
if (bp)
|
if (bp)
|
||||||
trace_xfs_btree_corrupt(bp, _RET_IP_);
|
trace_xfs_btree_corrupt(bp, _RET_IP_);
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1849,10 +1847,8 @@ xfs_btree_lookup(
|
||||||
XFS_BTREE_STATS_INC(cur, lookup);
|
XFS_BTREE_STATS_INC(cur, lookup);
|
||||||
|
|
||||||
/* No such thing as a zero-level tree. */
|
/* No such thing as a zero-level tree. */
|
||||||
if (cur->bc_nlevels == 0) {
|
if (XFS_IS_CORRUPT(cur->bc_mp, cur->bc_nlevels == 0))
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, cur->bc_mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
|
|
||||||
block = NULL;
|
block = NULL;
|
||||||
keyno = 0;
|
keyno = 0;
|
||||||
|
|
|
@ -1663,17 +1663,12 @@ xfs_da3_node_lookup_int(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We can't point back to the root. */
|
/* We can't point back to the root. */
|
||||||
if (blkno == args->geo->leafblk) {
|
if (XFS_IS_CORRUPT(dp->i_mount, blkno == args->geo->leafblk))
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
|
||||||
dp->i_mount);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expected_level != 0) {
|
if (XFS_IS_CORRUPT(dp->i_mount, expected_level != 0))
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, dp->i_mount);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A leaf block that ends in the hashval that we are interested in
|
* A leaf block that ends in the hashval that we are interested in
|
||||||
|
@ -2267,11 +2262,8 @@ xfs_da3_swap_lastblock(
|
||||||
error = xfs_bmap_last_before(tp, dp, &lastoff, w);
|
error = xfs_bmap_last_before(tp, dp, &lastoff, w);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
if (unlikely(lastoff == 0)) {
|
if (XFS_IS_CORRUPT(mp, lastoff == 0))
|
||||||
XFS_ERROR_REPORT("xfs_da_swap_lastblock(1)", XFS_ERRLEVEL_LOW,
|
|
||||||
mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Read the last block in the btree space.
|
* Read the last block in the btree space.
|
||||||
*/
|
*/
|
||||||
|
@ -2317,11 +2309,9 @@ xfs_da3_swap_lastblock(
|
||||||
if (error)
|
if (error)
|
||||||
goto done;
|
goto done;
|
||||||
sib_info = sib_buf->b_addr;
|
sib_info = sib_buf->b_addr;
|
||||||
if (unlikely(
|
if (XFS_IS_CORRUPT(mp,
|
||||||
be32_to_cpu(sib_info->forw) != last_blkno ||
|
be32_to_cpu(sib_info->forw) != last_blkno ||
|
||||||
sib_info->magic != dead_info->magic)) {
|
sib_info->magic != dead_info->magic)) {
|
||||||
XFS_ERROR_REPORT("xfs_da_swap_lastblock(2)",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -2339,11 +2329,9 @@ xfs_da3_swap_lastblock(
|
||||||
if (error)
|
if (error)
|
||||||
goto done;
|
goto done;
|
||||||
sib_info = sib_buf->b_addr;
|
sib_info = sib_buf->b_addr;
|
||||||
if (unlikely(
|
if (XFS_IS_CORRUPT(mp,
|
||||||
be32_to_cpu(sib_info->back) != last_blkno ||
|
be32_to_cpu(sib_info->back) != last_blkno ||
|
||||||
sib_info->magic != dead_info->magic)) {
|
sib_info->magic != dead_info->magic)) {
|
||||||
XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -2364,9 +2352,8 @@ xfs_da3_swap_lastblock(
|
||||||
goto done;
|
goto done;
|
||||||
par_node = par_buf->b_addr;
|
par_node = par_buf->b_addr;
|
||||||
xfs_da3_node_hdr_from_disk(dp->i_mount, &par_hdr, par_node);
|
xfs_da3_node_hdr_from_disk(dp->i_mount, &par_hdr, par_node);
|
||||||
if (level >= 0 && level != par_hdr.level + 1) {
|
if (XFS_IS_CORRUPT(mp,
|
||||||
XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)",
|
level >= 0 && level != par_hdr.level + 1)) {
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -2377,9 +2364,7 @@ xfs_da3_swap_lastblock(
|
||||||
be32_to_cpu(btree[entno].hashval) < dead_hash;
|
be32_to_cpu(btree[entno].hashval) < dead_hash;
|
||||||
entno++)
|
entno++)
|
||||||
continue;
|
continue;
|
||||||
if (entno == par_hdr.count) {
|
if (XFS_IS_CORRUPT(mp, entno == par_hdr.count)) {
|
||||||
XFS_ERROR_REPORT("xfs_da_swap_lastblock(5)",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -2404,9 +2389,7 @@ xfs_da3_swap_lastblock(
|
||||||
par_blkno = par_hdr.forw;
|
par_blkno = par_hdr.forw;
|
||||||
xfs_trans_brelse(tp, par_buf);
|
xfs_trans_brelse(tp, par_buf);
|
||||||
par_buf = NULL;
|
par_buf = NULL;
|
||||||
if (unlikely(par_blkno == 0)) {
|
if (XFS_IS_CORRUPT(mp, par_blkno == 0)) {
|
||||||
XFS_ERROR_REPORT("xfs_da_swap_lastblock(6)",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -2415,9 +2398,7 @@ xfs_da3_swap_lastblock(
|
||||||
goto done;
|
goto done;
|
||||||
par_node = par_buf->b_addr;
|
par_node = par_buf->b_addr;
|
||||||
xfs_da3_node_hdr_from_disk(dp->i_mount, &par_hdr, par_node);
|
xfs_da3_node_hdr_from_disk(dp->i_mount, &par_hdr, par_node);
|
||||||
if (par_hdr.level != level) {
|
if (XFS_IS_CORRUPT(mp, par_hdr.level != level)) {
|
||||||
XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -2611,7 +2592,7 @@ xfs_dabuf_map(
|
||||||
|
|
||||||
if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) {
|
if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) {
|
||||||
/* Caller ok with no mapping. */
|
/* Caller ok with no mapping. */
|
||||||
if (mappedbno == -2) {
|
if (!XFS_IS_CORRUPT(mp, mappedbno != -2)) {
|
||||||
error = -1;
|
error = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -2632,7 +2613,6 @@ xfs_dabuf_map(
|
||||||
irecs[i].br_state);
|
irecs[i].br_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XFS_ERROR_REPORT("xfs_da_do_buf(1)", XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,10 +208,10 @@ xfs_dir_ino_validate(
|
||||||
{
|
{
|
||||||
bool ino_ok = xfs_verify_dir_ino(mp, ino);
|
bool ino_ok = xfs_verify_dir_ino(mp, ino);
|
||||||
|
|
||||||
if (unlikely(XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE))) {
|
if (XFS_IS_CORRUPT(mp, !ino_ok) ||
|
||||||
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_DIR_INO_VALIDATE)) {
|
||||||
xfs_warn(mp, "Invalid inode number 0x%Lx",
|
xfs_warn(mp, "Invalid inode number 0x%Lx",
|
||||||
(unsigned long long) ino);
|
(unsigned long long) ino);
|
||||||
XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -617,10 +617,10 @@ xfs_dir2_isblock(
|
||||||
if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
|
if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
|
||||||
return rval;
|
return rval;
|
||||||
rval = XFS_FSB_TO_B(args->dp->i_mount, last) == args->geo->blksize;
|
rval = XFS_FSB_TO_B(args->dp->i_mount, last) == args->geo->blksize;
|
||||||
if (rval != 0 && args->dp->i_d.di_size != args->geo->blksize) {
|
if (XFS_IS_CORRUPT(args->dp->i_mount,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, args->dp->i_mount);
|
rval != 0 &&
|
||||||
|
args->dp->i_d.di_size != args->geo->blksize))
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
*vp = rval;
|
*vp = rval;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -728,10 +728,9 @@ xfs_dir2_leafn_lookup_for_addname(
|
||||||
* If it has room, return it.
|
* If it has room, return it.
|
||||||
*/
|
*/
|
||||||
xfs_dir2_free_hdr_from_disk(mp, &freehdr, free);
|
xfs_dir2_free_hdr_from_disk(mp, &freehdr, free);
|
||||||
if (unlikely(
|
if (XFS_IS_CORRUPT(mp,
|
||||||
freehdr.bests[fi] == cpu_to_be16(NULLDATAOFF))) {
|
freehdr.bests[fi] ==
|
||||||
XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int",
|
cpu_to_be16(NULLDATAOFF))) {
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
if (curfdb != newfdb)
|
if (curfdb != newfdb)
|
||||||
xfs_trans_brelse(tp, curbp);
|
xfs_trans_brelse(tp, curbp);
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
|
@ -1722,7 +1721,9 @@ xfs_dir2_node_add_datablk(
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if (xfs_dir2_db_to_fdb(args->geo, *dbno) != fbno) {
|
if (XFS_IS_CORRUPT(mp,
|
||||||
|
xfs_dir2_db_to_fdb(args->geo, *dbno) !=
|
||||||
|
fbno)) {
|
||||||
xfs_alert(mp,
|
xfs_alert(mp,
|
||||||
"%s: dir ino %llu needed freesp block %lld for data block %lld, got %lld",
|
"%s: dir ino %llu needed freesp block %lld for data block %lld, got %lld",
|
||||||
__func__, (unsigned long long)dp->i_ino,
|
__func__, (unsigned long long)dp->i_ino,
|
||||||
|
@ -1736,7 +1737,6 @@ xfs_dir2_node_add_datablk(
|
||||||
} else {
|
} else {
|
||||||
xfs_alert(mp, " ... fblk is NULL");
|
xfs_alert(mp, " ... fblk is NULL");
|
||||||
}
|
}
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ xfs_refcount_finish_one(
|
||||||
XFS_ALLOC_FLAG_FREEING, &agbp);
|
XFS_ALLOC_FLAG_FREEING, &agbp);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
if (!agbp)
|
if (XFS_IS_CORRUPT(tp->t_mountp, !agbp))
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
|
|
||||||
rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
|
rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
|
||||||
|
@ -1661,17 +1661,16 @@ struct xfs_refcount_recovery {
|
||||||
/* Stuff an extent on the recovery list. */
|
/* Stuff an extent on the recovery list. */
|
||||||
STATIC int
|
STATIC int
|
||||||
xfs_refcount_recover_extent(
|
xfs_refcount_recover_extent(
|
||||||
struct xfs_btree_cur *cur,
|
struct xfs_btree_cur *cur,
|
||||||
union xfs_btree_rec *rec,
|
union xfs_btree_rec *rec,
|
||||||
void *priv)
|
void *priv)
|
||||||
{
|
{
|
||||||
struct list_head *debris = priv;
|
struct list_head *debris = priv;
|
||||||
struct xfs_refcount_recovery *rr;
|
struct xfs_refcount_recovery *rr;
|
||||||
|
|
||||||
if (be32_to_cpu(rec->refc.rc_refcount) != 1) {
|
if (XFS_IS_CORRUPT(cur->bc_mp,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, cur->bc_mp);
|
be32_to_cpu(rec->refc.rc_refcount) != 1))
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
|
|
||||||
rr = kmem_alloc(sizeof(struct xfs_refcount_recovery), 0);
|
rr = kmem_alloc(sizeof(struct xfs_refcount_recovery), 0);
|
||||||
xfs_refcount_btrec_to_irec(rec, &rr->rr_rrec);
|
xfs_refcount_btrec_to_irec(rec, &rr->rr_rrec);
|
||||||
|
|
|
@ -2400,7 +2400,7 @@ xfs_rmap_finish_one(
|
||||||
error = xfs_free_extent_fix_freelist(tp, agno, &agbp);
|
error = xfs_free_extent_fix_freelist(tp, agno, &agbp);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
if (!agbp)
|
if (XFS_IS_CORRUPT(tp->t_mountp, !agbp))
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
|
|
||||||
rcur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
|
rcur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
|
||||||
|
|
|
@ -70,10 +70,8 @@ xfs_rtbuf_get(
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if (nmap == 0 || !xfs_bmap_is_real_extent(&map)) {
|
if (XFS_IS_CORRUPT(mp, nmap == 0 || !xfs_bmap_is_real_extent(&map)))
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(map.br_startblock != NULLFSBLOCK);
|
ASSERT(map.br_startblock != NULLFSBLOCK);
|
||||||
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
|
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
|
||||||
|
|
|
@ -86,11 +86,10 @@ xfs_attr_shortform_list(
|
||||||
(XFS_ISRESET_CURSOR(cursor) &&
|
(XFS_ISRESET_CURSOR(cursor) &&
|
||||||
(dp->i_afp->if_bytes + sf->hdr.count * 16) < context->bufsize)) {
|
(dp->i_afp->if_bytes + sf->hdr.count * 16) < context->bufsize)) {
|
||||||
for (i = 0, sfe = &sf->list[0]; i < sf->hdr.count; i++) {
|
for (i = 0, sfe = &sf->list[0]; i < sf->hdr.count; i++) {
|
||||||
if (!xfs_attr_namecheck(sfe->nameval, sfe->namelen)) {
|
if (XFS_IS_CORRUPT(context->dp->i_mount,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
!xfs_attr_namecheck(sfe->nameval,
|
||||||
context->dp->i_mount);
|
sfe->namelen)))
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
context->put_listent(context,
|
context->put_listent(context,
|
||||||
sfe->flags,
|
sfe->flags,
|
||||||
sfe->nameval,
|
sfe->nameval,
|
||||||
|
@ -179,9 +178,9 @@ xfs_attr_shortform_list(
|
||||||
cursor->hashval = sbp->hash;
|
cursor->hashval = sbp->hash;
|
||||||
cursor->offset = 0;
|
cursor->offset = 0;
|
||||||
}
|
}
|
||||||
if (!xfs_attr_namecheck(sbp->name, sbp->namelen)) {
|
if (XFS_IS_CORRUPT(context->dp->i_mount,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
!xfs_attr_namecheck(sbp->name,
|
||||||
context->dp->i_mount);
|
sbp->namelen))) {
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -269,10 +268,8 @@ xfs_attr_node_list_lookup(
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* We can't point back to the root. */
|
/* We can't point back to the root. */
|
||||||
if (cursor->blkno == 0) {
|
if (XFS_IS_CORRUPT(mp, cursor->blkno == 0))
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expected_level != 0)
|
if (expected_level != 0)
|
||||||
|
@ -473,11 +470,9 @@ xfs_attr3_leaf_list_int(
|
||||||
valuelen = be32_to_cpu(name_rmt->valuelen);
|
valuelen = be32_to_cpu(name_rmt->valuelen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xfs_attr_namecheck(name, namelen)) {
|
if (XFS_IS_CORRUPT(context->dp->i_mount,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
!xfs_attr_namecheck(name, namelen)))
|
||||||
context->dp->i_mount);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
context->put_listent(context, entry->flags,
|
context->put_listent(context, entry->flags,
|
||||||
name, namelen, valuelen);
|
name, namelen, valuelen);
|
||||||
if (context->seen_enough)
|
if (context->seen_enough)
|
||||||
|
|
|
@ -117,11 +117,10 @@ xfs_dir2_sf_getdents(
|
||||||
ino = xfs_dir2_sf_get_ino(mp, sfp, sfep);
|
ino = xfs_dir2_sf_get_ino(mp, sfp, sfep);
|
||||||
filetype = xfs_dir2_sf_get_ftype(mp, sfep);
|
filetype = xfs_dir2_sf_get_ftype(mp, sfep);
|
||||||
ctx->pos = off & 0x7fffffff;
|
ctx->pos = off & 0x7fffffff;
|
||||||
if (!xfs_dir2_namecheck(sfep->name, sfep->namelen)) {
|
if (XFS_IS_CORRUPT(dp->i_mount,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
!xfs_dir2_namecheck(sfep->name,
|
||||||
dp->i_mount);
|
sfep->namelen)))
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
if (!dir_emit(ctx, (char *)sfep->name, sfep->namelen, ino,
|
if (!dir_emit(ctx, (char *)sfep->name, sfep->namelen, ino,
|
||||||
xfs_dir3_get_dtype(mp, filetype)))
|
xfs_dir3_get_dtype(mp, filetype)))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -207,9 +206,9 @@ xfs_dir2_block_getdents(
|
||||||
/*
|
/*
|
||||||
* If it didn't fit, set the final offset to here & return.
|
* If it didn't fit, set the final offset to here & return.
|
||||||
*/
|
*/
|
||||||
if (!xfs_dir2_namecheck(dep->name, dep->namelen)) {
|
if (XFS_IS_CORRUPT(dp->i_mount,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
!xfs_dir2_namecheck(dep->name,
|
||||||
dp->i_mount);
|
dep->namelen))) {
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out_rele;
|
goto out_rele;
|
||||||
}
|
}
|
||||||
|
@ -459,9 +458,9 @@ xfs_dir2_leaf_getdents(
|
||||||
filetype = xfs_dir2_data_get_ftype(mp, dep);
|
filetype = xfs_dir2_data_get_ftype(mp, dep);
|
||||||
|
|
||||||
ctx->pos = xfs_dir2_byte_to_dataptr(curoff) & 0x7fffffff;
|
ctx->pos = xfs_dir2_byte_to_dataptr(curoff) & 0x7fffffff;
|
||||||
if (!xfs_dir2_namecheck(dep->name, dep->namelen)) {
|
if (XFS_IS_CORRUPT(dp->i_mount,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
!xfs_dir2_namecheck(dep->name,
|
||||||
dp->i_mount);
|
dep->namelen))) {
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -856,10 +856,8 @@ xfs_buffered_write_iomap_begin(
|
||||||
|
|
||||||
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
||||||
|
|
||||||
if (unlikely(XFS_TEST_ERROR(
|
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ip, XFS_DATA_FORK)) ||
|
||||||
!xfs_ifork_has_extents(ip, XFS_DATA_FORK),
|
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT)) {
|
||||||
mp, XFS_ERRTAG_BMAPIFORMAT))) {
|
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
|
@ -481,10 +481,8 @@ xfs_vn_get_link_inline(
|
||||||
* if_data is junk.
|
* if_data is junk.
|
||||||
*/
|
*/
|
||||||
link = ip->i_df.if_u1.if_data;
|
link = ip->i_df.if_u1.if_data;
|
||||||
if (!link) {
|
if (XFS_IS_CORRUPT(ip->i_mount, !link))
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, ip->i_mount);
|
|
||||||
return ERR_PTR(-EFSCORRUPTED);
|
return ERR_PTR(-EFSCORRUPTED);
|
||||||
}
|
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,9 @@ xlog_alloc_buffer(
|
||||||
* Pass log block 0 since we don't have an addr yet, buffer will be
|
* Pass log block 0 since we don't have an addr yet, buffer will be
|
||||||
* verified on read.
|
* verified on read.
|
||||||
*/
|
*/
|
||||||
if (!xlog_verify_bno(log, 0, nbblks)) {
|
if (XFS_IS_CORRUPT(log->l_mp, !xlog_verify_bno(log, 0, nbblks))) {
|
||||||
xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer",
|
xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer",
|
||||||
nbblks);
|
nbblks);
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_HIGH, log->l_mp);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,11 +151,10 @@ xlog_do_io(
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (!xlog_verify_bno(log, blk_no, nbblks)) {
|
if (XFS_IS_CORRUPT(log->l_mp, !xlog_verify_bno(log, blk_no, nbblks))) {
|
||||||
xfs_warn(log->l_mp,
|
xfs_warn(log->l_mp,
|
||||||
"Invalid log block/length (0x%llx, 0x%x) for buffer",
|
"Invalid log block/length (0x%llx, 0x%x) for buffer",
|
||||||
blk_no, nbblks);
|
blk_no, nbblks);
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_HIGH, log->l_mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,19 +242,17 @@ xlog_header_check_recover(
|
||||||
* (XLOG_FMT_UNKNOWN). This stops us from trying to recover
|
* (XLOG_FMT_UNKNOWN). This stops us from trying to recover
|
||||||
* a dirty log created in IRIX.
|
* a dirty log created in IRIX.
|
||||||
*/
|
*/
|
||||||
if (unlikely(head->h_fmt != cpu_to_be32(XLOG_FMT))) {
|
if (XFS_IS_CORRUPT(mp, head->h_fmt != cpu_to_be32(XLOG_FMT))) {
|
||||||
xfs_warn(mp,
|
xfs_warn(mp,
|
||||||
"dirty log written in incompatible format - can't recover");
|
"dirty log written in incompatible format - can't recover");
|
||||||
xlog_header_check_dump(mp, head);
|
xlog_header_check_dump(mp, head);
|
||||||
XFS_ERROR_REPORT("xlog_header_check_recover(1)",
|
|
||||||
XFS_ERRLEVEL_HIGH, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
} else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
|
}
|
||||||
|
if (XFS_IS_CORRUPT(mp, !uuid_equal(&mp->m_sb.sb_uuid,
|
||||||
|
&head->h_fs_uuid))) {
|
||||||
xfs_warn(mp,
|
xfs_warn(mp,
|
||||||
"dirty log entry has mismatched uuid - can't recover");
|
"dirty log entry has mismatched uuid - can't recover");
|
||||||
xlog_header_check_dump(mp, head);
|
xlog_header_check_dump(mp, head);
|
||||||
XFS_ERROR_REPORT("xlog_header_check_recover(2)",
|
|
||||||
XFS_ERRLEVEL_HIGH, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -279,11 +275,10 @@ xlog_header_check_mount(
|
||||||
* by IRIX and continue.
|
* by IRIX and continue.
|
||||||
*/
|
*/
|
||||||
xfs_warn(mp, "null uuid in log - IRIX style log");
|
xfs_warn(mp, "null uuid in log - IRIX style log");
|
||||||
} else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
|
} else if (XFS_IS_CORRUPT(mp, !uuid_equal(&mp->m_sb.sb_uuid,
|
||||||
|
&head->h_fs_uuid))) {
|
||||||
xfs_warn(mp, "log has mismatched uuid - can't recover");
|
xfs_warn(mp, "log has mismatched uuid - can't recover");
|
||||||
xlog_header_check_dump(mp, head);
|
xlog_header_check_dump(mp, head);
|
||||||
XFS_ERROR_REPORT("xlog_header_check_mount",
|
|
||||||
XFS_ERRLEVEL_HIGH, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1699,11 +1694,10 @@ xlog_clear_stale_blocks(
|
||||||
* the distance from the beginning of the log to the
|
* the distance from the beginning of the log to the
|
||||||
* tail.
|
* tail.
|
||||||
*/
|
*/
|
||||||
if (unlikely(head_block < tail_block || head_block >= log->l_logBBsize)) {
|
if (XFS_IS_CORRUPT(log->l_mp,
|
||||||
XFS_ERROR_REPORT("xlog_clear_stale_blocks(1)",
|
head_block < tail_block ||
|
||||||
XFS_ERRLEVEL_LOW, log->l_mp);
|
head_block >= log->l_logBBsize))
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
tail_distance = tail_block + (log->l_logBBsize - head_block);
|
tail_distance = tail_block + (log->l_logBBsize - head_block);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
@ -1711,11 +1705,10 @@ xlog_clear_stale_blocks(
|
||||||
* so the distance from the head to the tail is just
|
* so the distance from the head to the tail is just
|
||||||
* the tail block minus the head block.
|
* the tail block minus the head block.
|
||||||
*/
|
*/
|
||||||
if (unlikely(head_block >= tail_block || head_cycle != (tail_cycle + 1))){
|
if (XFS_IS_CORRUPT(log->l_mp,
|
||||||
XFS_ERROR_REPORT("xlog_clear_stale_blocks(2)",
|
head_block >= tail_block ||
|
||||||
XFS_ERRLEVEL_LOW, log->l_mp);
|
head_cycle != tail_cycle + 1))
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
tail_distance = tail_block - head_block;
|
tail_distance = tail_block - head_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2135,13 +2128,11 @@ xlog_recover_do_inode_buffer(
|
||||||
*/
|
*/
|
||||||
logged_nextp = item->ri_buf[item_index].i_addr +
|
logged_nextp = item->ri_buf[item_index].i_addr +
|
||||||
next_unlinked_offset - reg_buf_offset;
|
next_unlinked_offset - reg_buf_offset;
|
||||||
if (unlikely(*logged_nextp == 0)) {
|
if (XFS_IS_CORRUPT(mp, *logged_nextp == 0)) {
|
||||||
xfs_alert(mp,
|
xfs_alert(mp,
|
||||||
"Bad inode buffer log record (ptr = "PTR_FMT", bp = "PTR_FMT"). "
|
"Bad inode buffer log record (ptr = "PTR_FMT", bp = "PTR_FMT"). "
|
||||||
"Trying to replay bad (0) inode di_next_unlinked field.",
|
"Trying to replay bad (0) inode di_next_unlinked field.",
|
||||||
item, bp);
|
item, bp);
|
||||||
XFS_ERROR_REPORT("xlog_recover_do_inode_buf",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2969,22 +2960,18 @@ xlog_recover_inode_pass2(
|
||||||
* Make sure the place we're flushing out to really looks
|
* Make sure the place we're flushing out to really looks
|
||||||
* like an inode!
|
* like an inode!
|
||||||
*/
|
*/
|
||||||
if (unlikely(!xfs_verify_magic16(bp, dip->di_magic))) {
|
if (XFS_IS_CORRUPT(mp, !xfs_verify_magic16(bp, dip->di_magic))) {
|
||||||
xfs_alert(mp,
|
xfs_alert(mp,
|
||||||
"%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld",
|
"%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld",
|
||||||
__func__, dip, bp, in_f->ilf_ino);
|
__func__, dip, bp, in_f->ilf_ino);
|
||||||
XFS_ERROR_REPORT("xlog_recover_inode_pass2(1)",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out_release;
|
goto out_release;
|
||||||
}
|
}
|
||||||
ldip = item->ri_buf[1].i_addr;
|
ldip = item->ri_buf[1].i_addr;
|
||||||
if (unlikely(ldip->di_magic != XFS_DINODE_MAGIC)) {
|
if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) {
|
||||||
xfs_alert(mp,
|
xfs_alert(mp,
|
||||||
"%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld",
|
"%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld",
|
||||||
__func__, item, in_f->ilf_ino);
|
__func__, item, in_f->ilf_ino);
|
||||||
XFS_ERROR_REPORT("xlog_recover_inode_pass2(2)",
|
|
||||||
XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out_release;
|
goto out_release;
|
||||||
}
|
}
|
||||||
|
@ -5209,14 +5196,13 @@ xlog_valid_rec_header(
|
||||||
{
|
{
|
||||||
int hlen;
|
int hlen;
|
||||||
|
|
||||||
if (unlikely(rhead->h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM))) {
|
if (XFS_IS_CORRUPT(log->l_mp,
|
||||||
XFS_ERROR_REPORT("xlog_valid_rec_header(1)",
|
rhead->h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM)))
|
||||||
XFS_ERRLEVEL_LOW, log->l_mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
if (XFS_IS_CORRUPT(log->l_mp,
|
||||||
if (unlikely(
|
(!rhead->h_version ||
|
||||||
(!rhead->h_version ||
|
(be32_to_cpu(rhead->h_version) &
|
||||||
(be32_to_cpu(rhead->h_version) & (~XLOG_VERSION_OKBITS))))) {
|
(~XLOG_VERSION_OKBITS))))) {
|
||||||
xfs_warn(log->l_mp, "%s: unrecognised log version (%d).",
|
xfs_warn(log->l_mp, "%s: unrecognised log version (%d).",
|
||||||
__func__, be32_to_cpu(rhead->h_version));
|
__func__, be32_to_cpu(rhead->h_version));
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
|
@ -5224,16 +5210,11 @@ xlog_valid_rec_header(
|
||||||
|
|
||||||
/* LR body must have data or it wouldn't have been written */
|
/* LR body must have data or it wouldn't have been written */
|
||||||
hlen = be32_to_cpu(rhead->h_len);
|
hlen = be32_to_cpu(rhead->h_len);
|
||||||
if (unlikely( hlen <= 0 || hlen > INT_MAX )) {
|
if (XFS_IS_CORRUPT(log->l_mp, hlen <= 0 || hlen > INT_MAX))
|
||||||
XFS_ERROR_REPORT("xlog_valid_rec_header(2)",
|
|
||||||
XFS_ERRLEVEL_LOW, log->l_mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
if (XFS_IS_CORRUPT(log->l_mp,
|
||||||
if (unlikely( blkno > log->l_logBBsize || blkno > INT_MAX )) {
|
blkno > log->l_logBBsize || blkno > INT_MAX))
|
||||||
XFS_ERROR_REPORT("xlog_valid_rec_header(3)",
|
|
||||||
XFS_ERRLEVEL_LOW, log->l_mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -761,9 +761,8 @@ xfs_mountfs(
|
||||||
goto out_free_dir;
|
goto out_free_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sbp->sb_logblocks) {
|
if (XFS_IS_CORRUPT(mp, !sbp->sb_logblocks)) {
|
||||||
xfs_warn(mp, "no log defined");
|
xfs_warn(mp, "no log defined");
|
||||||
XFS_ERROR_REPORT("xfs_mountfs", XFS_ERRLEVEL_LOW, mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out_free_perag;
|
goto out_free_perag;
|
||||||
}
|
}
|
||||||
|
@ -801,12 +800,10 @@ xfs_mountfs(
|
||||||
|
|
||||||
ASSERT(rip != NULL);
|
ASSERT(rip != NULL);
|
||||||
|
|
||||||
if (unlikely(!S_ISDIR(VFS_I(rip)->i_mode))) {
|
if (XFS_IS_CORRUPT(mp, !S_ISDIR(VFS_I(rip)->i_mode))) {
|
||||||
xfs_warn(mp, "corrupted root inode %llu: not a directory",
|
xfs_warn(mp, "corrupted root inode %llu: not a directory",
|
||||||
(unsigned long long)rip->i_ino);
|
(unsigned long long)rip->i_ino);
|
||||||
xfs_iunlock(rip, XFS_ILOCK_EXCL);
|
xfs_iunlock(rip, XFS_ILOCK_EXCL);
|
||||||
XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW,
|
|
||||||
mp);
|
|
||||||
error = -EFSCORRUPTED;
|
error = -EFSCORRUPTED;
|
||||||
goto out_rele_rip;
|
goto out_rele_rip;
|
||||||
}
|
}
|
||||||
|
|
|
@ -755,19 +755,15 @@ xfs_qm_qino_alloc(
|
||||||
if ((flags & XFS_QMOPT_PQUOTA) &&
|
if ((flags & XFS_QMOPT_PQUOTA) &&
|
||||||
(mp->m_sb.sb_gquotino != NULLFSINO)) {
|
(mp->m_sb.sb_gquotino != NULLFSINO)) {
|
||||||
ino = mp->m_sb.sb_gquotino;
|
ino = mp->m_sb.sb_gquotino;
|
||||||
if (mp->m_sb.sb_pquotino != NULLFSINO) {
|
if (XFS_IS_CORRUPT(mp,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
mp->m_sb.sb_pquotino != NULLFSINO))
|
||||||
mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
} else if ((flags & XFS_QMOPT_GQUOTA) &&
|
} else if ((flags & XFS_QMOPT_GQUOTA) &&
|
||||||
(mp->m_sb.sb_pquotino != NULLFSINO)) {
|
(mp->m_sb.sb_pquotino != NULLFSINO)) {
|
||||||
ino = mp->m_sb.sb_pquotino;
|
ino = mp->m_sb.sb_pquotino;
|
||||||
if (mp->m_sb.sb_gquotino != NULLFSINO) {
|
if (XFS_IS_CORRUPT(mp,
|
||||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
|
mp->m_sb.sb_gquotino != NULLFSINO))
|
||||||
mp);
|
|
||||||
return -EFSCORRUPTED;
|
return -EFSCORRUPTED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ino != NULLFSINO) {
|
if (ino != NULLFSINO) {
|
||||||
error = xfs_iget(mp, NULL, ino, 0, 0, ip);
|
error = xfs_iget(mp, NULL, ino, 0, 0, ip);
|
||||||
|
|
Loading…
Reference in New Issue