Commit 989d5ec3 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: report XFS_IS_CORRUPT errors to the health system

Whenever we encounter XFS_IS_CORRUPT failures, we should report that to
the health monitoring system for later reporting.

I started with this semantic patch and massaged everything until it
built:

@@
expression mp, test;
@@

- if (XFS_IS_CORRUPT(mp, test)) return -EFSCORRUPTED;
+ if (XFS_IS_CORRUPT(mp, test)) { xfs_btree_mark_sick(cur); return -EFSCORRUPTED; }

@@
expression mp, test;
identifier label, error;
@@

- if (XFS_IS_CORRUPT(mp, test)) { error = -EFSCORRUPTED; goto label; }
+ if (XFS_IS_CORRUPT(mp, test)) { xfs_btree_mark_sick(cur); error = -EFSCORRUPTED; goto label; }
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 8368ad49
...@@ -951,8 +951,10 @@ xfs_ag_shrink_space( ...@@ -951,8 +951,10 @@ xfs_ag_shrink_space(
agf = agfbp->b_addr; agf = agfbp->b_addr;
aglen = be32_to_cpu(agi->agi_length); aglen = be32_to_cpu(agi->agi_length);
/* some extra paranoid checks before we shrink the ag */ /* some extra paranoid checks before we shrink the ag */
if (XFS_IS_CORRUPT(mp, agf->agf_length != agi->agi_length)) if (XFS_IS_CORRUPT(mp, agf->agf_length != agi->agi_length)) {
xfs_ag_mark_sick(pag, XFS_SICK_AG_AGF);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
if (delta >= aglen) if (delta >= aglen)
return -EINVAL; return -EINVAL;
......
This diff is collapsed.
...@@ -553,8 +553,10 @@ xfs_attr_rmtval_stale( ...@@ -553,8 +553,10 @@ xfs_attr_rmtval_stale(
xfs_assert_ilocked(ip, XFS_ILOCK_EXCL); xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
if (XFS_IS_CORRUPT(mp, map->br_startblock == DELAYSTARTBLOCK) || if (XFS_IS_CORRUPT(mp, map->br_startblock == DELAYSTARTBLOCK) ||
XFS_IS_CORRUPT(mp, map->br_startblock == HOLESTARTBLOCK)) XFS_IS_CORRUPT(mp, map->br_startblock == HOLESTARTBLOCK)) {
xfs_bmap_mark_sick(ip, XFS_ATTR_FORK);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
error = xfs_buf_incore(mp->m_ddev_targp, error = xfs_buf_incore(mp->m_ddev_targp,
XFS_FSB_TO_DADDR(mp, map->br_startblock), XFS_FSB_TO_DADDR(mp, map->br_startblock),
...@@ -664,8 +666,10 @@ xfs_attr_rmtval_invalidate( ...@@ -664,8 +666,10 @@ xfs_attr_rmtval_invalidate(
blkcnt, &map, &nmap, XFS_BMAPI_ATTRFORK); blkcnt, &map, &nmap, XFS_BMAPI_ATTRFORK);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(args->dp->i_mount, nmap != 1)) if (XFS_IS_CORRUPT(args->dp->i_mount, nmap != 1)) {
xfs_bmap_mark_sick(args->dp, XFS_ATTR_FORK);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
error = xfs_attr_rmtval_stale(args->dp, &map, XBF_TRYLOCK); error = xfs_attr_rmtval_stale(args->dp, &map, XBF_TRYLOCK);
if (error) if (error)
return error; return error;
......
This diff is collapsed.
...@@ -2026,8 +2026,10 @@ xfs_btree_lookup( ...@@ -2026,8 +2026,10 @@ xfs_btree_lookup(
error = xfs_btree_increment(cur, 0, &i); error = xfs_btree_increment(cur, 0, &i);
if (error) if (error)
goto error0; goto error0;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
*stat = 1; *stat = 1;
return 0; return 0;
} }
...@@ -2480,6 +2482,7 @@ xfs_btree_lshift( ...@@ -2480,6 +2482,7 @@ xfs_btree_lshift(
goto error0; goto error0;
i = xfs_btree_firstrec(tcur, level); i = xfs_btree_firstrec(tcur, level);
if (XFS_IS_CORRUPT(tcur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(tcur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -2650,6 +2653,7 @@ xfs_btree_rshift( ...@@ -2650,6 +2653,7 @@ xfs_btree_rshift(
goto error0; goto error0;
i = xfs_btree_lastrec(tcur, level); i = xfs_btree_lastrec(tcur, level);
if (XFS_IS_CORRUPT(tcur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(tcur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -3538,6 +3542,7 @@ xfs_btree_insert( ...@@ -3538,6 +3542,7 @@ xfs_btree_insert(
} }
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -3945,6 +3950,7 @@ xfs_btree_delrec( ...@@ -3945,6 +3950,7 @@ xfs_btree_delrec(
*/ */
i = xfs_btree_lastrec(tcur, level); i = xfs_btree_lastrec(tcur, level);
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -3953,12 +3959,14 @@ xfs_btree_delrec( ...@@ -3953,12 +3959,14 @@ xfs_btree_delrec(
if (error) if (error)
goto error0; goto error0;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
i = xfs_btree_lastrec(tcur, level); i = xfs_btree_lastrec(tcur, level);
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -4006,6 +4014,7 @@ xfs_btree_delrec( ...@@ -4006,6 +4014,7 @@ xfs_btree_delrec(
if (!xfs_btree_ptr_is_null(cur, &lptr)) { if (!xfs_btree_ptr_is_null(cur, &lptr)) {
i = xfs_btree_firstrec(tcur, level); i = xfs_btree_firstrec(tcur, level);
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -4014,6 +4023,7 @@ xfs_btree_delrec( ...@@ -4014,6 +4023,7 @@ xfs_btree_delrec(
if (error) if (error)
goto error0; goto error0;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -4031,6 +4041,7 @@ xfs_btree_delrec( ...@@ -4031,6 +4041,7 @@ xfs_btree_delrec(
*/ */
i = xfs_btree_firstrec(tcur, level); i = xfs_btree_firstrec(tcur, level);
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -4040,6 +4051,7 @@ xfs_btree_delrec( ...@@ -4040,6 +4051,7 @@ xfs_btree_delrec(
goto error0; goto error0;
i = xfs_btree_firstrec(tcur, level); i = xfs_btree_firstrec(tcur, level);
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
......
...@@ -573,6 +573,7 @@ xfs_inobt_insert_sprec( ...@@ -573,6 +573,7 @@ xfs_inobt_insert_sprec(
if (error) if (error)
goto error; goto error;
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error; goto error;
} }
...@@ -589,10 +590,12 @@ xfs_inobt_insert_sprec( ...@@ -589,10 +590,12 @@ xfs_inobt_insert_sprec(
if (error) if (error)
goto error; goto error;
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error; goto error;
} }
if (XFS_IS_CORRUPT(mp, rec.ir_startino != nrec->ir_startino)) { if (XFS_IS_CORRUPT(mp, rec.ir_startino != nrec->ir_startino)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error; goto error;
} }
...@@ -602,6 +605,7 @@ xfs_inobt_insert_sprec( ...@@ -602,6 +605,7 @@ xfs_inobt_insert_sprec(
* cannot merge, something is seriously wrong. * cannot merge, something is seriously wrong.
*/ */
if (XFS_IS_CORRUPT(mp, !__xfs_inobt_can_merge(nrec, &rec))) { if (XFS_IS_CORRUPT(mp, !__xfs_inobt_can_merge(nrec, &rec))) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error; goto error;
} }
...@@ -951,9 +955,11 @@ xfs_ialloc_next_rec( ...@@ -951,9 +955,11 @@ xfs_ialloc_next_rec(
error = xfs_inobt_get_rec(cur, rec, &i); error = xfs_inobt_get_rec(cur, rec, &i);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
}
return 0; return 0;
} }
...@@ -976,9 +982,11 @@ xfs_ialloc_get_rec( ...@@ -976,9 +982,11 @@ xfs_ialloc_get_rec(
error = xfs_inobt_get_rec(cur, rec, &i); error = xfs_inobt_get_rec(cur, rec, &i);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
}
return 0; return 0;
} }
...@@ -1055,6 +1063,7 @@ xfs_dialloc_ag_inobt( ...@@ -1055,6 +1063,7 @@ xfs_dialloc_ag_inobt(
if (error) if (error)
goto error0; goto error0;
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -1063,6 +1072,7 @@ xfs_dialloc_ag_inobt( ...@@ -1063,6 +1072,7 @@ xfs_dialloc_ag_inobt(
if (error) if (error)
goto error0; goto error0;
if (XFS_IS_CORRUPT(mp, j != 1)) { if (XFS_IS_CORRUPT(mp, j != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -1221,6 +1231,7 @@ xfs_dialloc_ag_inobt( ...@@ -1221,6 +1231,7 @@ xfs_dialloc_ag_inobt(
if (error) if (error)
goto error0; goto error0;
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -1230,6 +1241,7 @@ xfs_dialloc_ag_inobt( ...@@ -1230,6 +1241,7 @@ xfs_dialloc_ag_inobt(
if (error) if (error)
goto error0; goto error0;
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -1239,6 +1251,7 @@ xfs_dialloc_ag_inobt( ...@@ -1239,6 +1251,7 @@ xfs_dialloc_ag_inobt(
if (error) if (error)
goto error0; goto error0;
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -1299,8 +1312,10 @@ xfs_dialloc_ag_finobt_near( ...@@ -1299,8 +1312,10 @@ xfs_dialloc_ag_finobt_near(
error = xfs_inobt_get_rec(lcur, rec, &i); error = xfs_inobt_get_rec(lcur, rec, &i);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(lcur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(lcur->bc_mp, i != 1)) {
xfs_btree_mark_sick(lcur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
/* /*
* See if we've landed in the parent inode record. The finobt * See if we've landed in the parent inode record. The finobt
...@@ -1324,12 +1339,14 @@ xfs_dialloc_ag_finobt_near( ...@@ -1324,12 +1339,14 @@ xfs_dialloc_ag_finobt_near(
if (error) if (error)
goto error_rcur; goto error_rcur;
if (XFS_IS_CORRUPT(lcur->bc_mp, j != 1)) { if (XFS_IS_CORRUPT(lcur->bc_mp, j != 1)) {
xfs_btree_mark_sick(lcur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error_rcur; goto error_rcur;
} }
} }
if (XFS_IS_CORRUPT(lcur->bc_mp, i != 1 && j != 1)) { if (XFS_IS_CORRUPT(lcur->bc_mp, i != 1 && j != 1)) {
xfs_btree_mark_sick(lcur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error_rcur; goto error_rcur;
} }
...@@ -1385,8 +1402,10 @@ xfs_dialloc_ag_finobt_newino( ...@@ -1385,8 +1402,10 @@ xfs_dialloc_ag_finobt_newino(
error = xfs_inobt_get_rec(cur, rec, &i); error = xfs_inobt_get_rec(cur, rec, &i);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
return 0; return 0;
} }
} }
...@@ -1397,14 +1416,18 @@ xfs_dialloc_ag_finobt_newino( ...@@ -1397,14 +1416,18 @@ xfs_dialloc_ag_finobt_newino(
error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &i); error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &i);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
error = xfs_inobt_get_rec(cur, rec, &i); error = xfs_inobt_get_rec(cur, rec, &i);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
return 0; return 0;
} }
...@@ -1426,14 +1449,18 @@ xfs_dialloc_ag_update_inobt( ...@@ -1426,14 +1449,18 @@ xfs_dialloc_ag_update_inobt(
error = xfs_inobt_lookup(cur, frec->ir_startino, XFS_LOOKUP_EQ, &i); error = xfs_inobt_lookup(cur, frec->ir_startino, XFS_LOOKUP_EQ, &i);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
error = xfs_inobt_get_rec(cur, &rec, &i); error = xfs_inobt_get_rec(cur, &rec, &i);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
ASSERT((XFS_AGINO_TO_OFFSET(cur->bc_mp, rec.ir_startino) % ASSERT((XFS_AGINO_TO_OFFSET(cur->bc_mp, rec.ir_startino) %
XFS_INODES_PER_CHUNK) == 0); XFS_INODES_PER_CHUNK) == 0);
...@@ -1442,8 +1469,10 @@ xfs_dialloc_ag_update_inobt( ...@@ -1442,8 +1469,10 @@ xfs_dialloc_ag_update_inobt(
if (XFS_IS_CORRUPT(cur->bc_mp, if (XFS_IS_CORRUPT(cur->bc_mp,
rec.ir_free != frec->ir_free || rec.ir_free != frec->ir_free ||
rec.ir_freecount != frec->ir_freecount)) rec.ir_freecount != frec->ir_freecount)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
return xfs_inobt_update(cur, &rec); return xfs_inobt_update(cur, &rec);
} }
...@@ -1960,6 +1989,7 @@ xfs_difree_inobt( ...@@ -1960,6 +1989,7 @@ xfs_difree_inobt(
goto error0; goto error0;
} }
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -1970,6 +2000,7 @@ xfs_difree_inobt( ...@@ -1970,6 +2000,7 @@ xfs_difree_inobt(
goto error0; goto error0;
} }
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error0; goto error0;
} }
...@@ -2082,6 +2113,7 @@ xfs_difree_finobt( ...@@ -2082,6 +2113,7 @@ xfs_difree_finobt(
* something is out of sync. * something is out of sync.
*/ */
if (XFS_IS_CORRUPT(mp, ibtrec->ir_freecount != 1)) { if (XFS_IS_CORRUPT(mp, ibtrec->ir_freecount != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error; goto error;
} }
...@@ -2108,6 +2140,7 @@ xfs_difree_finobt( ...@@ -2108,6 +2140,7 @@ xfs_difree_finobt(
if (error) if (error)
goto error; goto error;
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error; goto error;
} }
...@@ -2118,6 +2151,7 @@ xfs_difree_finobt( ...@@ -2118,6 +2151,7 @@ xfs_difree_finobt(
if (XFS_IS_CORRUPT(mp, if (XFS_IS_CORRUPT(mp,
rec.ir_free != ibtrec->ir_free || rec.ir_free != ibtrec->ir_free ||
rec.ir_freecount != ibtrec->ir_freecount)) { rec.ir_freecount != ibtrec->ir_freecount)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto error; goto error;
} }
......
...@@ -240,6 +240,7 @@ xfs_refcount_insert( ...@@ -240,6 +240,7 @@ xfs_refcount_insert(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -270,12 +271,14 @@ xfs_refcount_delete( ...@@ -270,12 +271,14 @@ xfs_refcount_delete(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
trace_xfs_refcount_delete(cur->bc_mp, cur->bc_ag.pag->pag_agno, &irec); trace_xfs_refcount_delete(cur->bc_mp, cur->bc_ag.pag->pag_agno, &irec);
error = xfs_btree_delete(cur, i); error = xfs_btree_delete(cur, i);
if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -400,6 +403,7 @@ xfs_refcount_split_extent( ...@@ -400,6 +403,7 @@ xfs_refcount_split_extent(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -427,6 +431,7 @@ xfs_refcount_split_extent( ...@@ -427,6 +431,7 @@ xfs_refcount_split_extent(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -472,6 +477,7 @@ xfs_refcount_merge_center_extents( ...@@ -472,6 +477,7 @@ xfs_refcount_merge_center_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -480,6 +486,7 @@ xfs_refcount_merge_center_extents( ...@@ -480,6 +486,7 @@ xfs_refcount_merge_center_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -489,6 +496,7 @@ xfs_refcount_merge_center_extents( ...@@ -489,6 +496,7 @@ xfs_refcount_merge_center_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -500,6 +508,7 @@ xfs_refcount_merge_center_extents( ...@@ -500,6 +508,7 @@ xfs_refcount_merge_center_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -544,6 +553,7 @@ xfs_refcount_merge_left_extent( ...@@ -544,6 +553,7 @@ xfs_refcount_merge_left_extent(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -552,6 +562,7 @@ xfs_refcount_merge_left_extent( ...@@ -552,6 +562,7 @@ xfs_refcount_merge_left_extent(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -563,6 +574,7 @@ xfs_refcount_merge_left_extent( ...@@ -563,6 +574,7 @@ xfs_refcount_merge_left_extent(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -610,6 +622,7 @@ xfs_refcount_merge_right_extent( ...@@ -610,6 +622,7 @@ xfs_refcount_merge_right_extent(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -618,6 +631,7 @@ xfs_refcount_merge_right_extent( ...@@ -618,6 +631,7 @@ xfs_refcount_merge_right_extent(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -629,6 +643,7 @@ xfs_refcount_merge_right_extent( ...@@ -629,6 +643,7 @@ xfs_refcount_merge_right_extent(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -676,6 +691,7 @@ xfs_refcount_find_left_extents( ...@@ -676,6 +691,7 @@ xfs_refcount_find_left_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -695,6 +711,7 @@ xfs_refcount_find_left_extents( ...@@ -695,6 +711,7 @@ xfs_refcount_find_left_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -769,6 +786,7 @@ xfs_refcount_find_right_extents( ...@@ -769,6 +786,7 @@ xfs_refcount_find_right_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -788,6 +806,7 @@ xfs_refcount_find_right_extents( ...@@ -788,6 +806,7 @@ xfs_refcount_find_right_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1144,6 +1163,7 @@ xfs_refcount_adjust_extents( ...@@ -1144,6 +1163,7 @@ xfs_refcount_adjust_extents(
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, if (XFS_IS_CORRUPT(cur->bc_mp,
found_tmp != 1)) { found_tmp != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1182,6 +1202,7 @@ xfs_refcount_adjust_extents( ...@@ -1182,6 +1202,7 @@ xfs_refcount_adjust_extents(
*/ */
if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount == 0) || if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount == 0) ||
XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount > *aglen)) { XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount > *aglen)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1205,6 +1226,7 @@ xfs_refcount_adjust_extents( ...@@ -1205,6 +1226,7 @@ xfs_refcount_adjust_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1329,8 +1351,10 @@ xfs_refcount_continue_op( ...@@ -1329,8 +1351,10 @@ xfs_refcount_continue_op(
struct xfs_perag *pag = cur->bc_ag.pag; struct xfs_perag *pag = cur->bc_ag.pag;
if (XFS_IS_CORRUPT(mp, !xfs_verify_agbext(pag, new_agbno, if (XFS_IS_CORRUPT(mp, !xfs_verify_agbext(pag, new_agbno,
ri->ri_blockcount))) ri->ri_blockcount))) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
ri->ri_startblock = XFS_AGB_TO_FSB(mp, pag->pag_agno, new_agbno); ri->ri_startblock = XFS_AGB_TO_FSB(mp, pag->pag_agno, new_agbno);
...@@ -1537,6 +1561,7 @@ xfs_refcount_find_shared( ...@@ -1537,6 +1561,7 @@ xfs_refcount_find_shared(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1554,6 +1579,7 @@ xfs_refcount_find_shared( ...@@ -1554,6 +1579,7 @@ xfs_refcount_find_shared(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1587,6 +1613,7 @@ xfs_refcount_find_shared( ...@@ -1587,6 +1613,7 @@ xfs_refcount_find_shared(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1684,6 +1711,7 @@ xfs_refcount_adjust_cow_extents( ...@@ -1684,6 +1711,7 @@ xfs_refcount_adjust_cow_extents(
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec && if (XFS_IS_CORRUPT(cur->bc_mp, found_rec &&
ext.rc_domain != XFS_REFC_DOMAIN_COW)) { ext.rc_domain != XFS_REFC_DOMAIN_COW)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1699,6 +1727,7 @@ xfs_refcount_adjust_cow_extents( ...@@ -1699,6 +1727,7 @@ xfs_refcount_adjust_cow_extents(
/* Adding a CoW reservation, there should be nothing here. */ /* Adding a CoW reservation, there should be nothing here. */
if (XFS_IS_CORRUPT(cur->bc_mp, if (XFS_IS_CORRUPT(cur->bc_mp,
agbno + aglen > ext.rc_startblock)) { agbno + aglen > ext.rc_startblock)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1716,6 +1745,7 @@ xfs_refcount_adjust_cow_extents( ...@@ -1716,6 +1745,7 @@ xfs_refcount_adjust_cow_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_tmp != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_tmp != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1723,14 +1753,17 @@ xfs_refcount_adjust_cow_extents( ...@@ -1723,14 +1753,17 @@ xfs_refcount_adjust_cow_extents(
case XFS_REFCOUNT_ADJUST_COW_FREE: case XFS_REFCOUNT_ADJUST_COW_FREE:
/* Removing a CoW reservation, there should be one extent. */ /* Removing a CoW reservation, there should be one extent. */
if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_startblock != agbno)) { if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_startblock != agbno)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount != aglen)) { if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount != aglen)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_refcount != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_refcount != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1742,6 +1775,7 @@ xfs_refcount_adjust_cow_extents( ...@@ -1742,6 +1775,7 @@ xfs_refcount_adjust_cow_extents(
if (error) if (error)
goto out_error; goto out_error;
if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
...@@ -1904,6 +1938,7 @@ xfs_refcount_recover_extent( ...@@ -1904,6 +1938,7 @@ xfs_refcount_recover_extent(
if (xfs_refcount_check_irec(cur->bc_ag.pag, &rr->rr_rrec) != NULL || if (xfs_refcount_check_irec(cur->bc_ag.pag, &rr->rr_rrec) != NULL ||
XFS_IS_CORRUPT(cur->bc_mp, XFS_IS_CORRUPT(cur->bc_mp,
rr->rr_rrec.rc_domain != XFS_REFC_DOMAIN_COW)) { rr->rr_rrec.rc_domain != XFS_REFC_DOMAIN_COW)) {
xfs_btree_mark_sick(cur);
kfree(rr); kfree(rr);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
......
This diff is collapsed.
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "xfs_refcount_btree.h" #include "xfs_refcount_btree.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_health.h"
#include "scrub/xfs_scrub.h" #include "scrub/xfs_scrub.h"
#include "scrub/scrub.h" #include "scrub/scrub.h"
#include "scrub/common.h" #include "scrub/common.h"
...@@ -253,8 +254,10 @@ xrep_refc_walk_rmaps( ...@@ -253,8 +254,10 @@ xrep_refc_walk_rmaps(
error = xfs_rmap_get_rec(cur, &rmap, &have_gt); error = xfs_rmap_get_rec(cur, &rmap, &have_gt);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(mp, !have_gt)) if (XFS_IS_CORRUPT(mp, !have_gt)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
if (rmap.rm_owner == XFS_RMAP_OWN_COW) { if (rmap.rm_owner == XFS_RMAP_OWN_COW) {
error = xrep_refc_stash_cow(rr, rmap.rm_startblock, error = xrep_refc_stash_cow(rr, rmap.rm_startblock,
...@@ -425,8 +428,10 @@ xrep_refc_push_rmaps_at( ...@@ -425,8 +428,10 @@ xrep_refc_push_rmaps_at(
error = xfs_btree_decrement(sc->sa.rmap_cur, 0, &have_gt); error = xfs_btree_decrement(sc->sa.rmap_cur, 0, &have_gt);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(sc->mp, !have_gt)) if (XFS_IS_CORRUPT(sc->mp, !have_gt)) {
xfs_btree_mark_sick(sc->sa.rmap_cur);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
return 0; return 0;
} }
......
...@@ -83,8 +83,10 @@ xfs_attr_shortform_list( ...@@ -83,8 +83,10 @@ xfs_attr_shortform_list(
for (i = 0, sfe = xfs_attr_sf_firstentry(sf); i < sf->count; i++) { for (i = 0, sfe = xfs_attr_sf_firstentry(sf); i < sf->count; i++) {
if (XFS_IS_CORRUPT(context->dp->i_mount, if (XFS_IS_CORRUPT(context->dp->i_mount,
!xfs_attr_namecheck(sfe->nameval, !xfs_attr_namecheck(sfe->nameval,
sfe->namelen))) sfe->namelen))) {
xfs_dirattr_mark_sick(context->dp, XFS_ATTR_FORK);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
context->put_listent(context, context->put_listent(context,
sfe->flags, sfe->flags,
sfe->nameval, sfe->nameval,
...@@ -177,6 +179,7 @@ xfs_attr_shortform_list( ...@@ -177,6 +179,7 @@ xfs_attr_shortform_list(
if (XFS_IS_CORRUPT(context->dp->i_mount, if (XFS_IS_CORRUPT(context->dp->i_mount,
!xfs_attr_namecheck(sbp->name, !xfs_attr_namecheck(sbp->name,
sbp->namelen))) { sbp->namelen))) {
xfs_dirattr_mark_sick(context->dp, XFS_ATTR_FORK);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out; goto out;
} }
...@@ -471,8 +474,10 @@ xfs_attr3_leaf_list_int( ...@@ -471,8 +474,10 @@ xfs_attr3_leaf_list_int(
} }
if (XFS_IS_CORRUPT(context->dp->i_mount, if (XFS_IS_CORRUPT(context->dp->i_mount,
!xfs_attr_namecheck(name, namelen))) !xfs_attr_namecheck(name, namelen))) {
xfs_dirattr_mark_sick(context->dp, XFS_ATTR_FORK);
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)
......
...@@ -118,8 +118,10 @@ xfs_dir2_sf_getdents( ...@@ -118,8 +118,10 @@ xfs_dir2_sf_getdents(
ctx->pos = off & 0x7fffffff; ctx->pos = off & 0x7fffffff;
if (XFS_IS_CORRUPT(dp->i_mount, if (XFS_IS_CORRUPT(dp->i_mount,
!xfs_dir2_namecheck(sfep->name, !xfs_dir2_namecheck(sfep->name,
sfep->namelen))) sfep->namelen))) {
xfs_dirattr_mark_sick(dp, XFS_DATA_FORK);
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;
...@@ -211,6 +213,7 @@ xfs_dir2_block_getdents( ...@@ -211,6 +213,7 @@ xfs_dir2_block_getdents(
if (XFS_IS_CORRUPT(dp->i_mount, if (XFS_IS_CORRUPT(dp->i_mount,
!xfs_dir2_namecheck(dep->name, !xfs_dir2_namecheck(dep->name,
dep->namelen))) { dep->namelen))) {
xfs_dirattr_mark_sick(dp, XFS_DATA_FORK);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_rele; goto out_rele;
} }
...@@ -465,6 +468,7 @@ xfs_dir2_leaf_getdents( ...@@ -465,6 +468,7 @@ xfs_dir2_leaf_getdents(
if (XFS_IS_CORRUPT(dp->i_mount, if (XFS_IS_CORRUPT(dp->i_mount,
!xfs_dir2_namecheck(dep->name, !xfs_dir2_namecheck(dep->name,
dep->namelen))) { dep->namelen))) {
xfs_dirattr_mark_sick(dp, XFS_DATA_FORK);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
break; break;
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "xfs_trace.h" #include "xfs_trace.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_health.h"
/* /*
* Notes on an efficient, low latency fstrim algorithm * Notes on an efficient, low latency fstrim algorithm
...@@ -210,6 +211,7 @@ xfs_trim_gather_extents( ...@@ -210,6 +211,7 @@ xfs_trim_gather_extents(
if (error) if (error)
break; break;
if (XFS_IS_CORRUPT(mp, i != 1)) { if (XFS_IS_CORRUPT(mp, i != 1)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
break; break;
} }
......
...@@ -297,8 +297,10 @@ xfs_iwalk_ag_start( ...@@ -297,8 +297,10 @@ xfs_iwalk_ag_start(
error = xfs_inobt_get_rec(*curpp, irec, has_more); error = xfs_inobt_get_rec(*curpp, irec, has_more);
if (error) if (error)
return error; return error;
if (XFS_IS_CORRUPT(mp, *has_more != 1)) if (XFS_IS_CORRUPT(mp, *has_more != 1)) {
xfs_btree_mark_sick(*curpp);
return -EFSCORRUPTED; return -EFSCORRUPTED;
}
iwag->lastino = XFS_AGINO_TO_INO(mp, pag->pag_agno, iwag->lastino = XFS_AGINO_TO_INO(mp, pag->pag_agno,
irec->ir_startino + XFS_INODES_PER_CHUNK - 1); irec->ir_startino + XFS_INODES_PER_CHUNK - 1);
...@@ -425,6 +427,7 @@ xfs_iwalk_ag( ...@@ -425,6 +427,7 @@ xfs_iwalk_ag(
rec_fsino = XFS_AGINO_TO_INO(mp, pag->pag_agno, irec->ir_startino); rec_fsino = XFS_AGINO_TO_INO(mp, pag->pag_agno, irec->ir_startino);
if (iwag->lastino != NULLFSINO && if (iwag->lastino != NULLFSINO &&
XFS_IS_CORRUPT(mp, iwag->lastino >= rec_fsino)) { XFS_IS_CORRUPT(mp, iwag->lastino >= rec_fsino)) {
xfs_btree_mark_sick(cur);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment