Commit 5fb5aeee authored by Eric Sandeen's avatar Eric Sandeen Committed by Dave Chinner

xfs: pass mp to XFS_WANT_CORRUPTED_RETURN

Today, if we hit an XFS_WANT_CORRUPTED_RETURN we don't print any
information about which filesystem hit it.  Passing in the mp allows
us to print the filesystem (device) name, which is a pretty critical
piece of information.

Tested by running fsfuzzer 'til I hit some.
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent c29aad41
...@@ -315,6 +315,9 @@ xfs_alloc_fixup_trees( ...@@ -315,6 +315,9 @@ xfs_alloc_fixup_trees(
xfs_agblock_t nfbno2; /* second new free startblock */ xfs_agblock_t nfbno2; /* second new free startblock */
xfs_extlen_t nflen1=0; /* first new free length */ xfs_extlen_t nflen1=0; /* first new free length */
xfs_extlen_t nflen2=0; /* second new free length */ xfs_extlen_t nflen2=0; /* second new free length */
struct xfs_mount *mp;
mp = cnt_cur->bc_mp;
/* /*
* Look up the record in the by-size tree if necessary. * Look up the record in the by-size tree if necessary.
...@@ -323,13 +326,13 @@ xfs_alloc_fixup_trees( ...@@ -323,13 +326,13 @@ xfs_alloc_fixup_trees(
#ifdef DEBUG #ifdef DEBUG
if ((error = xfs_alloc_get_rec(cnt_cur, &nfbno1, &nflen1, &i))) if ((error = xfs_alloc_get_rec(cnt_cur, &nfbno1, &nflen1, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
i == 1 && nfbno1 == fbno && nflen1 == flen); i == 1 && nfbno1 == fbno && nflen1 == flen);
#endif #endif
} else { } else {
if ((error = xfs_alloc_lookup_eq(cnt_cur, fbno, flen, &i))) if ((error = xfs_alloc_lookup_eq(cnt_cur, fbno, flen, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
} }
/* /*
* Look up the record in the by-block tree if necessary. * Look up the record in the by-block tree if necessary.
...@@ -338,13 +341,13 @@ xfs_alloc_fixup_trees( ...@@ -338,13 +341,13 @@ xfs_alloc_fixup_trees(
#ifdef DEBUG #ifdef DEBUG
if ((error = xfs_alloc_get_rec(bno_cur, &nfbno1, &nflen1, &i))) if ((error = xfs_alloc_get_rec(bno_cur, &nfbno1, &nflen1, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
i == 1 && nfbno1 == fbno && nflen1 == flen); i == 1 && nfbno1 == fbno && nflen1 == flen);
#endif #endif
} else { } else {
if ((error = xfs_alloc_lookup_eq(bno_cur, fbno, flen, &i))) if ((error = xfs_alloc_lookup_eq(bno_cur, fbno, flen, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
} }
#ifdef DEBUG #ifdef DEBUG
...@@ -355,7 +358,7 @@ xfs_alloc_fixup_trees( ...@@ -355,7 +358,7 @@ xfs_alloc_fixup_trees(
bnoblock = XFS_BUF_TO_BLOCK(bno_cur->bc_bufs[0]); bnoblock = XFS_BUF_TO_BLOCK(bno_cur->bc_bufs[0]);
cntblock = XFS_BUF_TO_BLOCK(cnt_cur->bc_bufs[0]); cntblock = XFS_BUF_TO_BLOCK(cnt_cur->bc_bufs[0]);
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
bnoblock->bb_numrecs == cntblock->bb_numrecs); bnoblock->bb_numrecs == cntblock->bb_numrecs);
} }
#endif #endif
...@@ -386,25 +389,25 @@ xfs_alloc_fixup_trees( ...@@ -386,25 +389,25 @@ xfs_alloc_fixup_trees(
*/ */
if ((error = xfs_btree_delete(cnt_cur, &i))) if ((error = xfs_btree_delete(cnt_cur, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
/* /*
* Add new by-size btree entry(s). * Add new by-size btree entry(s).
*/ */
if (nfbno1 != NULLAGBLOCK) { if (nfbno1 != NULLAGBLOCK) {
if ((error = xfs_alloc_lookup_eq(cnt_cur, nfbno1, nflen1, &i))) if ((error = xfs_alloc_lookup_eq(cnt_cur, nfbno1, nflen1, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 0); XFS_WANT_CORRUPTED_RETURN(mp, i == 0);
if ((error = xfs_btree_insert(cnt_cur, &i))) if ((error = xfs_btree_insert(cnt_cur, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
} }
if (nfbno2 != NULLAGBLOCK) { if (nfbno2 != NULLAGBLOCK) {
if ((error = xfs_alloc_lookup_eq(cnt_cur, nfbno2, nflen2, &i))) if ((error = xfs_alloc_lookup_eq(cnt_cur, nfbno2, nflen2, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 0); XFS_WANT_CORRUPTED_RETURN(mp, i == 0);
if ((error = xfs_btree_insert(cnt_cur, &i))) if ((error = xfs_btree_insert(cnt_cur, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
} }
/* /*
* Fix up the by-block btree entry(s). * Fix up the by-block btree entry(s).
...@@ -415,7 +418,7 @@ xfs_alloc_fixup_trees( ...@@ -415,7 +418,7 @@ xfs_alloc_fixup_trees(
*/ */
if ((error = xfs_btree_delete(bno_cur, &i))) if ((error = xfs_btree_delete(bno_cur, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
} else { } else {
/* /*
* Update the by-block entry to start later|be shorter. * Update the by-block entry to start later|be shorter.
...@@ -429,10 +432,10 @@ xfs_alloc_fixup_trees( ...@@ -429,10 +432,10 @@ xfs_alloc_fixup_trees(
*/ */
if ((error = xfs_alloc_lookup_eq(bno_cur, nfbno2, nflen2, &i))) if ((error = xfs_alloc_lookup_eq(bno_cur, nfbno2, nflen2, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 0); XFS_WANT_CORRUPTED_RETURN(mp, i == 0);
if ((error = xfs_btree_insert(bno_cur, &i))) if ((error = xfs_btree_insert(bno_cur, &i)))
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
} }
return 0; return 0;
} }
......
...@@ -5460,6 +5460,7 @@ xfs_bmse_merge( ...@@ -5460,6 +5460,7 @@ xfs_bmse_merge(
struct xfs_bmbt_irec left; struct xfs_bmbt_irec left;
xfs_filblks_t blockcount; xfs_filblks_t blockcount;
int error, i; int error, i;
struct xfs_mount *mp = ip->i_mount;
xfs_bmbt_get_all(gotp, &got); xfs_bmbt_get_all(gotp, &got);
xfs_bmbt_get_all(leftp, &left); xfs_bmbt_get_all(leftp, &left);
...@@ -5494,19 +5495,19 @@ xfs_bmse_merge( ...@@ -5494,19 +5495,19 @@ xfs_bmse_merge(
got.br_blockcount, &i); got.br_blockcount, &i);
if (error) if (error)
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
error = xfs_btree_delete(cur, &i); error = xfs_btree_delete(cur, &i);
if (error) if (error)
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
/* lookup and update size of the previous extent */ /* lookup and update size of the previous extent */
error = xfs_bmbt_lookup_eq(cur, left.br_startoff, left.br_startblock, error = xfs_bmbt_lookup_eq(cur, left.br_startoff, left.br_startblock,
left.br_blockcount, &i); left.br_blockcount, &i);
if (error) if (error)
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
left.br_blockcount = blockcount; left.br_blockcount = blockcount;
...@@ -5528,6 +5529,7 @@ xfs_bmse_shift_one( ...@@ -5528,6 +5529,7 @@ xfs_bmse_shift_one(
int *logflags) int *logflags)
{ {
struct xfs_ifork *ifp; struct xfs_ifork *ifp;
struct xfs_mount *mp;
xfs_fileoff_t startoff; xfs_fileoff_t startoff;
struct xfs_bmbt_rec_host *leftp; struct xfs_bmbt_rec_host *leftp;
struct xfs_bmbt_irec got; struct xfs_bmbt_irec got;
...@@ -5535,13 +5537,14 @@ xfs_bmse_shift_one( ...@@ -5535,13 +5537,14 @@ xfs_bmse_shift_one(
int error; int error;
int i; int i;
mp = ip->i_mount;
ifp = XFS_IFORK_PTR(ip, whichfork); ifp = XFS_IFORK_PTR(ip, whichfork);
xfs_bmbt_get_all(gotp, &got); xfs_bmbt_get_all(gotp, &got);
startoff = got.br_startoff - offset_shift_fsb; startoff = got.br_startoff - offset_shift_fsb;
/* delalloc extents should be prevented by caller */ /* delalloc extents should be prevented by caller */
XFS_WANT_CORRUPTED_RETURN(!isnullstartblock(got.br_startblock)); XFS_WANT_CORRUPTED_RETURN(mp, !isnullstartblock(got.br_startblock));
/* /*
* Check for merge if we've got an extent to the left, otherwise make * Check for merge if we've got an extent to the left, otherwise make
...@@ -5580,7 +5583,7 @@ xfs_bmse_shift_one( ...@@ -5580,7 +5583,7 @@ xfs_bmse_shift_one(
got.br_blockcount, &i); got.br_blockcount, &i);
if (error) if (error)
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(mp, i == 1);
got.br_startoff = startoff; got.br_startoff = startoff;
return xfs_bmbt_update(cur, got.br_startoff, got.br_startblock, return xfs_bmbt_update(cur, got.br_startoff, got.br_startblock,
......
...@@ -168,7 +168,7 @@ xfs_btree_check_lptr( ...@@ -168,7 +168,7 @@ xfs_btree_check_lptr(
xfs_fsblock_t bno, /* btree block disk address */ xfs_fsblock_t bno, /* btree block disk address */
int level) /* btree block level */ int level) /* btree block level */
{ {
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(cur->bc_mp,
level > 0 && level > 0 &&
bno != NULLFSBLOCK && bno != NULLFSBLOCK &&
XFS_FSB_SANITY_CHECK(cur->bc_mp, bno)); XFS_FSB_SANITY_CHECK(cur->bc_mp, bno));
...@@ -187,7 +187,7 @@ xfs_btree_check_sptr( ...@@ -187,7 +187,7 @@ xfs_btree_check_sptr(
{ {
xfs_agblock_t agblocks = cur->bc_mp->m_sb.sb_agblocks; xfs_agblock_t agblocks = cur->bc_mp->m_sb.sb_agblocks;
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(cur->bc_mp,
level > 0 && level > 0 &&
bno != NULLAGBLOCK && bno != NULLAGBLOCK &&
bno != 0 && bno != 0 &&
...@@ -1825,7 +1825,7 @@ xfs_btree_lookup( ...@@ -1825,7 +1825,7 @@ 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;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, i == 1);
XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT); XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT);
*stat = 1; *stat = 1;
return 0; return 0;
......
...@@ -89,7 +89,7 @@ __xfs_dir3_data_check( ...@@ -89,7 +89,7 @@ __xfs_dir3_data_check(
* so just ensure that the count falls somewhere inside the * so just ensure that the count falls somewhere inside the
* block right now. * block right now.
*/ */
XFS_WANT_CORRUPTED_RETURN(be32_to_cpu(btp->count) < XFS_WANT_CORRUPTED_RETURN(mp, be32_to_cpu(btp->count) <
((char *)btp - p) / sizeof(struct xfs_dir2_leaf_entry)); ((char *)btp - p) / sizeof(struct xfs_dir2_leaf_entry));
break; break;
case cpu_to_be32(XFS_DIR3_DATA_MAGIC): case cpu_to_be32(XFS_DIR3_DATA_MAGIC):
...@@ -107,21 +107,21 @@ __xfs_dir3_data_check( ...@@ -107,21 +107,21 @@ __xfs_dir3_data_check(
bf = ops->data_bestfree_p(hdr); bf = ops->data_bestfree_p(hdr);
count = lastfree = freeseen = 0; count = lastfree = freeseen = 0;
if (!bf[0].length) { if (!bf[0].length) {
XFS_WANT_CORRUPTED_RETURN(!bf[0].offset); XFS_WANT_CORRUPTED_RETURN(mp, !bf[0].offset);
freeseen |= 1 << 0; freeseen |= 1 << 0;
} }
if (!bf[1].length) { if (!bf[1].length) {
XFS_WANT_CORRUPTED_RETURN(!bf[1].offset); XFS_WANT_CORRUPTED_RETURN(mp, !bf[1].offset);
freeseen |= 1 << 1; freeseen |= 1 << 1;
} }
if (!bf[2].length) { if (!bf[2].length) {
XFS_WANT_CORRUPTED_RETURN(!bf[2].offset); XFS_WANT_CORRUPTED_RETURN(mp, !bf[2].offset);
freeseen |= 1 << 2; freeseen |= 1 << 2;
} }
XFS_WANT_CORRUPTED_RETURN(be16_to_cpu(bf[0].length) >= XFS_WANT_CORRUPTED_RETURN(mp, be16_to_cpu(bf[0].length) >=
be16_to_cpu(bf[1].length)); be16_to_cpu(bf[1].length));
XFS_WANT_CORRUPTED_RETURN(be16_to_cpu(bf[1].length) >= XFS_WANT_CORRUPTED_RETURN(mp, be16_to_cpu(bf[1].length) >=
be16_to_cpu(bf[2].length)); be16_to_cpu(bf[2].length));
/* /*
* Loop over the data/unused entries. * Loop over the data/unused entries.
...@@ -134,18 +134,18 @@ __xfs_dir3_data_check( ...@@ -134,18 +134,18 @@ __xfs_dir3_data_check(
* doesn't need to be there. * doesn't need to be there.
*/ */
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
XFS_WANT_CORRUPTED_RETURN(lastfree == 0); XFS_WANT_CORRUPTED_RETURN(mp, lastfree == 0);
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) == be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) ==
(char *)dup - (char *)hdr); (char *)dup - (char *)hdr);
dfp = xfs_dir2_data_freefind(hdr, bf, dup); dfp = xfs_dir2_data_freefind(hdr, bf, dup);
if (dfp) { if (dfp) {
i = (int)(dfp - bf); i = (int)(dfp - bf);
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
(freeseen & (1 << i)) == 0); (freeseen & (1 << i)) == 0);
freeseen |= 1 << i; freeseen |= 1 << i;
} else { } else {
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
be16_to_cpu(dup->length) <= be16_to_cpu(dup->length) <=
be16_to_cpu(bf[2].length)); be16_to_cpu(bf[2].length));
} }
...@@ -160,13 +160,13 @@ __xfs_dir3_data_check( ...@@ -160,13 +160,13 @@ __xfs_dir3_data_check(
* The linear search is crude but this is DEBUG code. * The linear search is crude but this is DEBUG code.
*/ */
dep = (xfs_dir2_data_entry_t *)p; dep = (xfs_dir2_data_entry_t *)p;
XFS_WANT_CORRUPTED_RETURN(dep->namelen != 0); XFS_WANT_CORRUPTED_RETURN(mp, dep->namelen != 0);
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
!xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber))); !xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber)));
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
be16_to_cpu(*ops->data_entry_tag_p(dep)) == be16_to_cpu(*ops->data_entry_tag_p(dep)) ==
(char *)dep - (char *)hdr); (char *)dep - (char *)hdr);
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
ops->data_get_ftype(dep) < XFS_DIR3_FT_MAX); ops->data_get_ftype(dep) < XFS_DIR3_FT_MAX);
count++; count++;
lastfree = 0; lastfree = 0;
...@@ -183,14 +183,15 @@ __xfs_dir3_data_check( ...@@ -183,14 +183,15 @@ __xfs_dir3_data_check(
be32_to_cpu(lep[i].hashval) == hash) be32_to_cpu(lep[i].hashval) == hash)
break; break;
} }
XFS_WANT_CORRUPTED_RETURN(i < be32_to_cpu(btp->count)); XFS_WANT_CORRUPTED_RETURN(mp,
i < be32_to_cpu(btp->count));
} }
p += ops->data_entsize(dep->namelen); p += ops->data_entsize(dep->namelen);
} }
/* /*
* Need to have seen all the entries and all the bestfree slots. * Need to have seen all the entries and all the bestfree slots.
*/ */
XFS_WANT_CORRUPTED_RETURN(freeseen == 7); XFS_WANT_CORRUPTED_RETURN(mp, freeseen == 7);
if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) {
for (i = stale = 0; i < be32_to_cpu(btp->count); i++) { for (i = stale = 0; i < be32_to_cpu(btp->count); i++) {
...@@ -198,13 +199,13 @@ __xfs_dir3_data_check( ...@@ -198,13 +199,13 @@ __xfs_dir3_data_check(
cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) cpu_to_be32(XFS_DIR2_NULL_DATAPTR))
stale++; stale++;
if (i > 0) if (i > 0)
XFS_WANT_CORRUPTED_RETURN( XFS_WANT_CORRUPTED_RETURN(mp,
be32_to_cpu(lep[i].hashval) >= be32_to_cpu(lep[i].hashval) >=
be32_to_cpu(lep[i - 1].hashval)); be32_to_cpu(lep[i - 1].hashval));
} }
XFS_WANT_CORRUPTED_RETURN(count == XFS_WANT_CORRUPTED_RETURN(mp, count ==
be32_to_cpu(btp->count) - be32_to_cpu(btp->stale)); be32_to_cpu(btp->count) - be32_to_cpu(btp->stale));
XFS_WANT_CORRUPTED_RETURN(stale == be32_to_cpu(btp->stale)); XFS_WANT_CORRUPTED_RETURN(mp, stale == be32_to_cpu(btp->stale));
} }
return 0; return 0;
} }
......
...@@ -700,7 +700,7 @@ xfs_ialloc_next_rec( ...@@ -700,7 +700,7 @@ 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;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, i == 1);
} }
return 0; return 0;
...@@ -724,7 +724,7 @@ xfs_ialloc_get_rec( ...@@ -724,7 +724,7 @@ 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;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, i == 1);
} }
return 0; return 0;
...@@ -1016,7 +1016,7 @@ xfs_dialloc_ag_finobt_near( ...@@ -1016,7 +1016,7 @@ 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;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(lcur->bc_mp, i == 1);
/* /*
* See if we've landed in the parent inode record. The finobt * See if we've landed in the parent inode record. The finobt
...@@ -1095,7 +1095,7 @@ xfs_dialloc_ag_finobt_newino( ...@@ -1095,7 +1095,7 @@ 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;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, i == 1);
return 0; return 0;
} }
} }
...@@ -1106,12 +1106,12 @@ xfs_dialloc_ag_finobt_newino( ...@@ -1106,12 +1106,12 @@ 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;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, i == 1);
error = xfs_inobt_get_rec(cur, rec, &i); error = xfs_inobt_get_rec(cur, rec, &i);
if (error) if (error)
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, i == 1);
return 0; return 0;
} }
...@@ -1133,19 +1133,19 @@ xfs_dialloc_ag_update_inobt( ...@@ -1133,19 +1133,19 @@ 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;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, i == 1);
error = xfs_inobt_get_rec(cur, &rec, &i); error = xfs_inobt_get_rec(cur, &rec, &i);
if (error) if (error)
return error; return error;
XFS_WANT_CORRUPTED_RETURN(i == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, i == 1);
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);
rec.ir_free &= ~XFS_INOBT_MASK(offset); rec.ir_free &= ~XFS_INOBT_MASK(offset);
rec.ir_freecount--; rec.ir_freecount--;
XFS_WANT_CORRUPTED_RETURN((rec.ir_free == frec->ir_free) && XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, (rec.ir_free == frec->ir_free) &&
(rec.ir_freecount == frec->ir_freecount)); (rec.ir_freecount == frec->ir_freecount));
return xfs_inobt_update(cur, &rec); return xfs_inobt_update(cur, &rec);
......
...@@ -52,13 +52,13 @@ extern void xfs_verifier_error(struct xfs_buf *bp); ...@@ -52,13 +52,13 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
} \ } \
} }
#define XFS_WANT_CORRUPTED_RETURN(x) \ #define XFS_WANT_CORRUPTED_RETURN(mp, x) \
{ \ { \
int fs_is_ok = (x); \ int fs_is_ok = (x); \
ASSERT(fs_is_ok); \ ASSERT(fs_is_ok); \
if (unlikely(!fs_is_ok)) { \ if (unlikely(!fs_is_ok)) { \
XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \ XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \
XFS_ERRLEVEL_LOW, NULL); \ XFS_ERRLEVEL_LOW, mp); \
return -EFSCORRUPTED; \ return -EFSCORRUPTED; \
} \ } \
} }
......
...@@ -229,7 +229,7 @@ xfs_bulkstat_grab_ichunk( ...@@ -229,7 +229,7 @@ xfs_bulkstat_grab_ichunk(
error = xfs_inobt_get_rec(cur, irec, &stat); error = xfs_inobt_get_rec(cur, irec, &stat);
if (error) if (error)
return error; return error;
XFS_WANT_CORRUPTED_RETURN(stat == 1); XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, stat == 1);
/* Check if the record contains the inode in request */ /* Check if the record contains the inode in request */
if (irec->ir_startino + XFS_INODES_PER_CHUNK <= agino) { if (irec->ir_startino + XFS_INODES_PER_CHUNK <= agino) {
......
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