Merge branch 'xfs-misc-fixes-for-4.1' into for-next

This commit is contained in:
Dave Chinner 2015-02-24 10:24:07 +11:00
commit 3cabb836d8
19 changed files with 288 additions and 274 deletions

View file

@ -228,30 +228,19 @@ default behaviour.
Deprecated Mount Options Deprecated Mount Options
======================== ========================
delaylog/nodelaylog None at present.
Delayed logging is the only logging method that XFS supports
now, so these mount options are now ignored.
Due for removal in 3.12.
ihashsize=value Removed Mount Options
In memory inode hashes have been removed, so this option has =====================
no function as of August 2007. Option is deprecated.
Due for removal in 3.12. Name Removed
---- -------
delaylog/nodelaylog v3.20
ihashsize v3.20
irixsgid v3.20
osyncisdsync/osyncisosync v3.20
irixsgid
This behaviour is now controlled by a sysctl, so the mount
option is ignored.
Due for removal in 3.12.
osyncisdsync
osyncisosync
O_SYNC and O_DSYNC are fully supported, so there is no need
for these options any more.
Due for removal in 3.12.
sysctls sysctls
======= =======

View file

@ -260,6 +260,7 @@ xfs_alloc_fix_len(
rlen = rlen - (k - args->mod); rlen = rlen - (k - args->mod);
else else
rlen = rlen - args->prod + (args->mod - k); rlen = rlen - args->prod + (args->mod - k);
/* casts to (int) catch length underflows */
if ((int)rlen < (int)args->minlen) if ((int)rlen < (int)args->minlen)
return; return;
ASSERT(rlen >= args->minlen && rlen <= args->maxlen); ASSERT(rlen >= args->minlen && rlen <= args->maxlen);
@ -286,7 +287,8 @@ xfs_alloc_fix_minleft(
if (diff >= 0) if (diff >= 0)
return 1; return 1;
args->len += diff; /* shrink the allocated space */ args->len += diff; /* shrink the allocated space */
if (args->len >= args->minlen) /* casts to (int) catch length underflows */
if ((int)args->len >= (int)args->minlen)
return 1; return 1;
args->agbno = NULLAGBLOCK; args->agbno = NULLAGBLOCK;
return 0; return 0;
@ -315,6 +317,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 +328,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 +343,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 +360,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 +391,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 +420,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 +434,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;
} }
@ -682,7 +687,7 @@ xfs_alloc_ag_vextent_exact(
error = xfs_alloc_get_rec(bno_cur, &fbno, &flen, &i); error = xfs_alloc_get_rec(bno_cur, &fbno, &flen, &i);
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
ASSERT(fbno <= args->agbno); ASSERT(fbno <= args->agbno);
/* /*
@ -783,7 +788,7 @@ xfs_alloc_find_best_extent(
error = xfs_alloc_get_rec(*scur, sbno, slen, &i); error = xfs_alloc_get_rec(*scur, sbno, slen, &i);
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
xfs_alloc_compute_aligned(args, *sbno, *slen, sbnoa, slena); xfs_alloc_compute_aligned(args, *sbno, *slen, sbnoa, slena);
/* /*
@ -946,7 +951,7 @@ restart:
if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno,
&ltlen, &i))) &ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
if (ltlen >= args->minlen) if (ltlen >= args->minlen)
break; break;
if ((error = xfs_btree_increment(cnt_cur, 0, &i))) if ((error = xfs_btree_increment(cnt_cur, 0, &i)))
@ -966,7 +971,7 @@ restart:
*/ */
if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i))) if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
xfs_alloc_compute_aligned(args, ltbno, ltlen, xfs_alloc_compute_aligned(args, ltbno, ltlen,
&ltbnoa, &ltlena); &ltbnoa, &ltlena);
if (ltlena < args->minlen) if (ltlena < args->minlen)
@ -999,7 +1004,7 @@ restart:
cnt_cur->bc_ptrs[0] = besti; cnt_cur->bc_ptrs[0] = besti;
if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i))) if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
ASSERT(ltbno + ltlen <= be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length)); ASSERT(ltbno + ltlen <= be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length));
args->len = blen; args->len = blen;
if (!xfs_alloc_fix_minleft(args)) { if (!xfs_alloc_fix_minleft(args)) {
@ -1088,7 +1093,7 @@ restart:
if (bno_cur_lt) { if (bno_cur_lt) {
if ((error = xfs_alloc_get_rec(bno_cur_lt, &ltbno, &ltlen, &i))) if ((error = xfs_alloc_get_rec(bno_cur_lt, &ltbno, &ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
xfs_alloc_compute_aligned(args, ltbno, ltlen, xfs_alloc_compute_aligned(args, ltbno, ltlen,
&ltbnoa, &ltlena); &ltbnoa, &ltlena);
if (ltlena >= args->minlen) if (ltlena >= args->minlen)
@ -1104,7 +1109,7 @@ restart:
if (bno_cur_gt) { if (bno_cur_gt) {
if ((error = xfs_alloc_get_rec(bno_cur_gt, &gtbno, &gtlen, &i))) if ((error = xfs_alloc_get_rec(bno_cur_gt, &gtbno, &gtlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
xfs_alloc_compute_aligned(args, gtbno, gtlen, xfs_alloc_compute_aligned(args, gtbno, gtlen,
&gtbnoa, &gtlena); &gtbnoa, &gtlena);
if (gtlena >= args->minlen) if (gtlena >= args->minlen)
@ -1303,7 +1308,7 @@ restart:
error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, &i); error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, &i);
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
xfs_alloc_compute_aligned(args, fbno, flen, xfs_alloc_compute_aligned(args, fbno, flen,
&rbno, &rlen); &rbno, &rlen);
@ -1342,7 +1347,7 @@ restart:
* This can't happen in the second case above. * This can't happen in the second case above.
*/ */
rlen = XFS_EXTLEN_MIN(args->maxlen, rlen); rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
XFS_WANT_CORRUPTED_GOTO(rlen == 0 || XFS_WANT_CORRUPTED_GOTO(args->mp, rlen == 0 ||
(rlen <= flen && rbno + rlen <= fbno + flen), error0); (rlen <= flen && rbno + rlen <= fbno + flen), error0);
if (rlen < args->maxlen) { if (rlen < args->maxlen) {
xfs_agblock_t bestfbno; xfs_agblock_t bestfbno;
@ -1362,13 +1367,13 @@ restart:
if ((error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, if ((error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen,
&i))) &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
if (flen < bestrlen) if (flen < bestrlen)
break; break;
xfs_alloc_compute_aligned(args, fbno, flen, xfs_alloc_compute_aligned(args, fbno, flen,
&rbno, &rlen); &rbno, &rlen);
rlen = XFS_EXTLEN_MIN(args->maxlen, rlen); rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
XFS_WANT_CORRUPTED_GOTO(rlen == 0 || XFS_WANT_CORRUPTED_GOTO(args->mp, rlen == 0 ||
(rlen <= flen && rbno + rlen <= fbno + flen), (rlen <= flen && rbno + rlen <= fbno + flen),
error0); error0);
if (rlen > bestrlen) { if (rlen > bestrlen) {
@ -1383,7 +1388,7 @@ restart:
if ((error = xfs_alloc_lookup_eq(cnt_cur, bestfbno, bestflen, if ((error = xfs_alloc_lookup_eq(cnt_cur, bestfbno, bestflen,
&i))) &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
rlen = bestrlen; rlen = bestrlen;
rbno = bestrbno; rbno = bestrbno;
flen = bestflen; flen = bestflen;
@ -1408,7 +1413,7 @@ restart:
if (!xfs_alloc_fix_minleft(args)) if (!xfs_alloc_fix_minleft(args))
goto out_nominleft; goto out_nominleft;
rlen = args->len; rlen = args->len;
XFS_WANT_CORRUPTED_GOTO(rlen <= flen, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, rlen <= flen, error0);
/* /*
* Allocate and initialize a cursor for the by-block tree. * Allocate and initialize a cursor for the by-block tree.
*/ */
@ -1422,7 +1427,7 @@ restart:
cnt_cur = bno_cur = NULL; cnt_cur = bno_cur = NULL;
args->len = rlen; args->len = rlen;
args->agbno = rbno; args->agbno = rbno;
XFS_WANT_CORRUPTED_GOTO( XFS_WANT_CORRUPTED_GOTO(args->mp,
args->agbno + args->len <= args->agbno + args->len <=
be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length), be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length),
error0); error0);
@ -1467,7 +1472,7 @@ xfs_alloc_ag_vextent_small(
if (i) { if (i) {
if ((error = xfs_alloc_get_rec(ccur, &fbno, &flen, &i))) if ((error = xfs_alloc_get_rec(ccur, &fbno, &flen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
} }
/* /*
* Nothing in the btree, try the freelist. Make sure * Nothing in the btree, try the freelist. Make sure
@ -1493,7 +1498,7 @@ xfs_alloc_ag_vextent_small(
} }
args->len = 1; args->len = 1;
args->agbno = fbno; args->agbno = fbno;
XFS_WANT_CORRUPTED_GOTO( XFS_WANT_CORRUPTED_GOTO(args->mp,
args->agbno + args->len <= args->agbno + args->len <=
be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length), be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length),
error0); error0);
@ -1579,7 +1584,7 @@ xfs_free_ag_extent(
*/ */
if ((error = xfs_alloc_get_rec(bno_cur, &ltbno, &ltlen, &i))) if ((error = xfs_alloc_get_rec(bno_cur, &ltbno, &ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
/* /*
* It's not contiguous, though. * It's not contiguous, though.
*/ */
@ -1591,7 +1596,8 @@ xfs_free_ag_extent(
* space was invalid, it's (partly) already free. * space was invalid, it's (partly) already free.
* Very bad. * Very bad.
*/ */
XFS_WANT_CORRUPTED_GOTO(ltbno + ltlen <= bno, error0); XFS_WANT_CORRUPTED_GOTO(mp,
ltbno + ltlen <= bno, error0);
} }
} }
/* /*
@ -1606,7 +1612,7 @@ xfs_free_ag_extent(
*/ */
if ((error = xfs_alloc_get_rec(bno_cur, &gtbno, &gtlen, &i))) if ((error = xfs_alloc_get_rec(bno_cur, &gtbno, &gtlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
/* /*
* It's not contiguous, though. * It's not contiguous, though.
*/ */
@ -1618,7 +1624,7 @@ xfs_free_ag_extent(
* space was invalid, it's (partly) already free. * space was invalid, it's (partly) already free.
* Very bad. * Very bad.
*/ */
XFS_WANT_CORRUPTED_GOTO(gtbno >= bno + len, error0); XFS_WANT_CORRUPTED_GOTO(mp, gtbno >= bno + len, error0);
} }
} }
/* /*
@ -1635,31 +1641,31 @@ xfs_free_ag_extent(
*/ */
if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i))) if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
if ((error = xfs_btree_delete(cnt_cur, &i))) if ((error = xfs_btree_delete(cnt_cur, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
/* /*
* Delete the old by-size entry on the right. * Delete the old by-size entry on the right.
*/ */
if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i))) if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
if ((error = xfs_btree_delete(cnt_cur, &i))) if ((error = xfs_btree_delete(cnt_cur, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
/* /*
* Delete the old by-block entry for the right block. * Delete the old by-block entry for the right block.
*/ */
if ((error = xfs_btree_delete(bno_cur, &i))) if ((error = xfs_btree_delete(bno_cur, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
/* /*
* Move the by-block cursor back to the left neighbor. * Move the by-block cursor back to the left neighbor.
*/ */
if ((error = xfs_btree_decrement(bno_cur, 0, &i))) if ((error = xfs_btree_decrement(bno_cur, 0, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
#ifdef DEBUG #ifdef DEBUG
/* /*
* Check that this is the right record: delete didn't * Check that this is the right record: delete didn't
@ -1672,7 +1678,7 @@ xfs_free_ag_extent(
if ((error = xfs_alloc_get_rec(bno_cur, &xxbno, &xxlen, if ((error = xfs_alloc_get_rec(bno_cur, &xxbno, &xxlen,
&i))) &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO( XFS_WANT_CORRUPTED_GOTO(mp,
i == 1 && xxbno == ltbno && xxlen == ltlen, i == 1 && xxbno == ltbno && xxlen == ltlen,
error0); error0);
} }
@ -1695,17 +1701,17 @@ xfs_free_ag_extent(
*/ */
if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i))) if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
if ((error = xfs_btree_delete(cnt_cur, &i))) if ((error = xfs_btree_delete(cnt_cur, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
/* /*
* Back up the by-block cursor to the left neighbor, and * Back up the by-block cursor to the left neighbor, and
* update its length. * update its length.
*/ */
if ((error = xfs_btree_decrement(bno_cur, 0, &i))) if ((error = xfs_btree_decrement(bno_cur, 0, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
nbno = ltbno; nbno = ltbno;
nlen = len + ltlen; nlen = len + ltlen;
if ((error = xfs_alloc_update(bno_cur, nbno, nlen))) if ((error = xfs_alloc_update(bno_cur, nbno, nlen)))
@ -1721,10 +1727,10 @@ xfs_free_ag_extent(
*/ */
if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i))) if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
if ((error = xfs_btree_delete(cnt_cur, &i))) if ((error = xfs_btree_delete(cnt_cur, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
/* /*
* Update the starting block and length of the right * Update the starting block and length of the right
* neighbor in the by-block tree. * neighbor in the by-block tree.
@ -1743,7 +1749,7 @@ xfs_free_ag_extent(
nlen = len; nlen = len;
if ((error = xfs_btree_insert(bno_cur, &i))) if ((error = xfs_btree_insert(bno_cur, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
} }
xfs_btree_del_cursor(bno_cur, XFS_BTREE_NOERROR); xfs_btree_del_cursor(bno_cur, XFS_BTREE_NOERROR);
bno_cur = NULL; bno_cur = NULL;
@ -1752,10 +1758,10 @@ xfs_free_ag_extent(
*/ */
if ((error = xfs_alloc_lookup_eq(cnt_cur, nbno, nlen, &i))) if ((error = xfs_alloc_lookup_eq(cnt_cur, nbno, nlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 0, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 0, error0);
if ((error = xfs_btree_insert(cnt_cur, &i))) if ((error = xfs_btree_insert(cnt_cur, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
cnt_cur = NULL; cnt_cur = NULL;

View file

@ -410,7 +410,7 @@ xfs_bmap_check_leaf_extents(
goto error_norelse; goto error_norelse;
} }
block = XFS_BUF_TO_BLOCK(bp); block = XFS_BUF_TO_BLOCK(bp);
XFS_WANT_CORRUPTED_GOTO( XFS_WANT_CORRUPTED_GOTO(mp,
xfs_bmap_sanity_check(mp, bp, level), xfs_bmap_sanity_check(mp, bp, level),
error0); error0);
if (level == 0) if (level == 0)
@ -424,7 +424,8 @@ xfs_bmap_check_leaf_extents(
xfs_check_block(block, mp, 0, 0); xfs_check_block(block, mp, 0, 0);
pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]); pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
bno = be64_to_cpu(*pp); bno = be64_to_cpu(*pp);
XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0); XFS_WANT_CORRUPTED_GOTO(mp,
XFS_FSB_SANITY_CHECK(mp, bno), error0);
if (bp_release) { if (bp_release) {
bp_release = 0; bp_release = 0;
xfs_trans_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
@ -1029,7 +1030,7 @@ xfs_bmap_add_attrfork_btree(
if ((error = xfs_bmbt_lookup_ge(cur, 0, 0, 0, &stat))) if ((error = xfs_bmbt_lookup_ge(cur, 0, 0, 0, &stat)))
goto error0; goto error0;
/* must be at least one entry */ /* must be at least one entry */
XFS_WANT_CORRUPTED_GOTO(stat == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, stat == 1, error0);
if ((error = xfs_btree_new_iroot(cur, flags, &stat))) if ((error = xfs_btree_new_iroot(cur, flags, &stat)))
goto error0; goto error0;
if (stat == 0) { if (stat == 0) {
@ -1311,14 +1312,14 @@ xfs_bmap_read_extents(
if (error) if (error)
return error; return error;
block = XFS_BUF_TO_BLOCK(bp); block = XFS_BUF_TO_BLOCK(bp);
XFS_WANT_CORRUPTED_GOTO( XFS_WANT_CORRUPTED_GOTO(mp,
xfs_bmap_sanity_check(mp, bp, level), xfs_bmap_sanity_check(mp, bp, level), error0);
error0);
if (level == 0) if (level == 0)
break; break;
pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]); pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
bno = be64_to_cpu(*pp); bno = be64_to_cpu(*pp);
XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0); XFS_WANT_CORRUPTED_GOTO(mp,
XFS_FSB_SANITY_CHECK(mp, bno), error0);
xfs_trans_brelse(tp, bp); xfs_trans_brelse(tp, bp);
} }
/* /*
@ -1345,7 +1346,7 @@ xfs_bmap_read_extents(
XFS_ERRLEVEL_LOW, ip->i_mount, block); XFS_ERRLEVEL_LOW, ip->i_mount, block);
goto error0; goto error0;
} }
XFS_WANT_CORRUPTED_GOTO( XFS_WANT_CORRUPTED_GOTO(mp,
xfs_bmap_sanity_check(mp, bp, 0), xfs_bmap_sanity_check(mp, bp, 0),
error0); error0);
/* /*
@ -1755,7 +1756,9 @@ xfs_bmap_add_extent_delay_real(
xfs_filblks_t temp=0; /* value for da_new calculations */ xfs_filblks_t temp=0; /* value for da_new calculations */
xfs_filblks_t temp2=0;/* value for da_new calculations */ xfs_filblks_t temp2=0;/* value for da_new calculations */
int tmp_rval; /* partial logging flags */ int tmp_rval; /* partial logging flags */
struct xfs_mount *mp;
mp = bma->tp ? bma->tp->t_mountp : NULL;
ifp = XFS_IFORK_PTR(bma->ip, XFS_DATA_FORK); ifp = XFS_IFORK_PTR(bma->ip, XFS_DATA_FORK);
ASSERT(bma->idx >= 0); ASSERT(bma->idx >= 0);
@ -1866,15 +1869,15 @@ xfs_bmap_add_extent_delay_real(
RIGHT.br_blockcount, &i); RIGHT.br_blockcount, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_btree_delete(bma->cur, &i); error = xfs_btree_delete(bma->cur, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_btree_decrement(bma->cur, 0, &i); error = xfs_btree_decrement(bma->cur, 0, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_bmbt_update(bma->cur, LEFT.br_startoff, error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
LEFT.br_startblock, LEFT.br_startblock,
LEFT.br_blockcount + LEFT.br_blockcount +
@ -1907,7 +1910,7 @@ xfs_bmap_add_extent_delay_real(
&i); &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_bmbt_update(bma->cur, LEFT.br_startoff, error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
LEFT.br_startblock, LEFT.br_startblock,
LEFT.br_blockcount + LEFT.br_blockcount +
@ -1938,7 +1941,7 @@ xfs_bmap_add_extent_delay_real(
RIGHT.br_blockcount, &i); RIGHT.br_blockcount, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_bmbt_update(bma->cur, PREV.br_startoff, error = xfs_bmbt_update(bma->cur, PREV.br_startoff,
new->br_startblock, new->br_startblock,
PREV.br_blockcount + PREV.br_blockcount +
@ -1968,12 +1971,12 @@ xfs_bmap_add_extent_delay_real(
&i); &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 0, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
bma->cur->bc_rec.b.br_state = XFS_EXT_NORM; bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
error = xfs_btree_insert(bma->cur, &i); error = xfs_btree_insert(bma->cur, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
break; break;
@ -2001,7 +2004,7 @@ xfs_bmap_add_extent_delay_real(
&i); &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_bmbt_update(bma->cur, LEFT.br_startoff, error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
LEFT.br_startblock, LEFT.br_startblock,
LEFT.br_blockcount + LEFT.br_blockcount +
@ -2038,12 +2041,12 @@ xfs_bmap_add_extent_delay_real(
&i); &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 0, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
bma->cur->bc_rec.b.br_state = XFS_EXT_NORM; bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
error = xfs_btree_insert(bma->cur, &i); error = xfs_btree_insert(bma->cur, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) { if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
@ -2084,7 +2087,7 @@ xfs_bmap_add_extent_delay_real(
RIGHT.br_blockcount, &i); RIGHT.br_blockcount, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_bmbt_update(bma->cur, new->br_startoff, error = xfs_bmbt_update(bma->cur, new->br_startoff,
new->br_startblock, new->br_startblock,
new->br_blockcount + new->br_blockcount +
@ -2122,12 +2125,12 @@ xfs_bmap_add_extent_delay_real(
&i); &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 0, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
bma->cur->bc_rec.b.br_state = XFS_EXT_NORM; bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
error = xfs_btree_insert(bma->cur, &i); error = xfs_btree_insert(bma->cur, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) { if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
@ -2191,12 +2194,12 @@ xfs_bmap_add_extent_delay_real(
&i); &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 0, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
bma->cur->bc_rec.b.br_state = XFS_EXT_NORM; bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
error = xfs_btree_insert(bma->cur, &i); error = xfs_btree_insert(bma->cur, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) { if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
@ -2309,6 +2312,7 @@ xfs_bmap_add_extent_unwritten_real(
/* left is 0, right is 1, prev is 2 */ /* left is 0, right is 1, prev is 2 */
int rval=0; /* return value (logging flags) */ int rval=0; /* return value (logging flags) */
int state = 0;/* state bits, accessed thru macros */ int state = 0;/* state bits, accessed thru macros */
struct xfs_mount *mp = tp->t_mountp;
*logflagsp = 0; *logflagsp = 0;
@ -2421,19 +2425,19 @@ xfs_bmap_add_extent_unwritten_real(
RIGHT.br_startblock, RIGHT.br_startblock,
RIGHT.br_blockcount, &i))) RIGHT.br_blockcount, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_btree_delete(cur, &i))) if ((error = xfs_btree_delete(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_btree_decrement(cur, 0, &i))) if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_btree_delete(cur, &i))) if ((error = xfs_btree_delete(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_btree_decrement(cur, 0, &i))) if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_bmbt_update(cur, LEFT.br_startoff, if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
LEFT.br_startblock, LEFT.br_startblock,
LEFT.br_blockcount + PREV.br_blockcount + LEFT.br_blockcount + PREV.br_blockcount +
@ -2464,13 +2468,13 @@ xfs_bmap_add_extent_unwritten_real(
PREV.br_startblock, PREV.br_blockcount, PREV.br_startblock, PREV.br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_btree_delete(cur, &i))) if ((error = xfs_btree_delete(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_btree_decrement(cur, 0, &i))) if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_bmbt_update(cur, LEFT.br_startoff, if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
LEFT.br_startblock, LEFT.br_startblock,
LEFT.br_blockcount + PREV.br_blockcount, LEFT.br_blockcount + PREV.br_blockcount,
@ -2499,13 +2503,13 @@ xfs_bmap_add_extent_unwritten_real(
RIGHT.br_startblock, RIGHT.br_startblock,
RIGHT.br_blockcount, &i))) RIGHT.br_blockcount, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_btree_delete(cur, &i))) if ((error = xfs_btree_delete(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_btree_decrement(cur, 0, &i))) if ((error = xfs_btree_decrement(cur, 0, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_bmbt_update(cur, new->br_startoff, if ((error = xfs_bmbt_update(cur, new->br_startoff,
new->br_startblock, new->br_startblock,
new->br_blockcount + RIGHT.br_blockcount, new->br_blockcount + RIGHT.br_blockcount,
@ -2532,7 +2536,7 @@ xfs_bmap_add_extent_unwritten_real(
new->br_startblock, new->br_blockcount, new->br_startblock, new->br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_bmbt_update(cur, new->br_startoff, if ((error = xfs_bmbt_update(cur, new->br_startoff,
new->br_startblock, new->br_blockcount, new->br_startblock, new->br_blockcount,
newext))) newext)))
@ -2569,7 +2573,7 @@ xfs_bmap_add_extent_unwritten_real(
PREV.br_startblock, PREV.br_blockcount, PREV.br_startblock, PREV.br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_bmbt_update(cur, if ((error = xfs_bmbt_update(cur,
PREV.br_startoff + new->br_blockcount, PREV.br_startoff + new->br_blockcount,
PREV.br_startblock + new->br_blockcount, PREV.br_startblock + new->br_blockcount,
@ -2611,7 +2615,7 @@ xfs_bmap_add_extent_unwritten_real(
PREV.br_startblock, PREV.br_blockcount, PREV.br_startblock, PREV.br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_bmbt_update(cur, if ((error = xfs_bmbt_update(cur,
PREV.br_startoff + new->br_blockcount, PREV.br_startoff + new->br_blockcount,
PREV.br_startblock + new->br_blockcount, PREV.br_startblock + new->br_blockcount,
@ -2621,7 +2625,7 @@ xfs_bmap_add_extent_unwritten_real(
cur->bc_rec.b = *new; cur->bc_rec.b = *new;
if ((error = xfs_btree_insert(cur, &i))) if ((error = xfs_btree_insert(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
break; break;
@ -2651,7 +2655,7 @@ xfs_bmap_add_extent_unwritten_real(
PREV.br_startblock, PREV.br_startblock,
PREV.br_blockcount, &i))) PREV.br_blockcount, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_bmbt_update(cur, PREV.br_startoff, if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
PREV.br_startblock, PREV.br_startblock,
PREV.br_blockcount - new->br_blockcount, PREV.br_blockcount - new->br_blockcount,
@ -2689,7 +2693,7 @@ xfs_bmap_add_extent_unwritten_real(
PREV.br_startblock, PREV.br_blockcount, PREV.br_startblock, PREV.br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
if ((error = xfs_bmbt_update(cur, PREV.br_startoff, if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
PREV.br_startblock, PREV.br_startblock,
PREV.br_blockcount - new->br_blockcount, PREV.br_blockcount - new->br_blockcount,
@ -2699,11 +2703,11 @@ xfs_bmap_add_extent_unwritten_real(
new->br_startblock, new->br_blockcount, new->br_startblock, new->br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 0, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
cur->bc_rec.b.br_state = XFS_EXT_NORM; cur->bc_rec.b.br_state = XFS_EXT_NORM;
if ((error = xfs_btree_insert(cur, &i))) if ((error = xfs_btree_insert(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
break; break;
@ -2737,7 +2741,7 @@ xfs_bmap_add_extent_unwritten_real(
PREV.br_startblock, PREV.br_blockcount, PREV.br_startblock, PREV.br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
/* new right extent - oldext */ /* new right extent - oldext */
if ((error = xfs_bmbt_update(cur, r[1].br_startoff, if ((error = xfs_bmbt_update(cur, r[1].br_startoff,
r[1].br_startblock, r[1].br_blockcount, r[1].br_startblock, r[1].br_blockcount,
@ -2749,7 +2753,7 @@ xfs_bmap_add_extent_unwritten_real(
new->br_startoff - PREV.br_startoff; new->br_startoff - PREV.br_startoff;
if ((error = xfs_btree_insert(cur, &i))) if ((error = xfs_btree_insert(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
/* /*
* Reset the cursor to the position of the new extent * Reset the cursor to the position of the new extent
* we are about to insert as we can't trust it after * we are about to insert as we can't trust it after
@ -2759,12 +2763,12 @@ xfs_bmap_add_extent_unwritten_real(
new->br_startblock, new->br_blockcount, new->br_startblock, new->br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 0, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
/* new middle extent - newext */ /* new middle extent - newext */
cur->bc_rec.b.br_state = new->br_state; cur->bc_rec.b.br_state = new->br_state;
if ((error = xfs_btree_insert(cur, &i))) if ((error = xfs_btree_insert(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
break; break;
@ -2968,7 +2972,9 @@ xfs_bmap_add_extent_hole_real(
xfs_bmbt_irec_t right; /* right neighbor extent entry */ xfs_bmbt_irec_t right; /* right neighbor extent entry */
int rval=0; /* return value (logging flags) */ int rval=0; /* return value (logging flags) */
int state; /* state bits, accessed thru macros */ int state; /* state bits, accessed thru macros */
struct xfs_mount *mp;
mp = bma->tp ? bma->tp->t_mountp : NULL;
ifp = XFS_IFORK_PTR(bma->ip, whichfork); ifp = XFS_IFORK_PTR(bma->ip, whichfork);
ASSERT(bma->idx >= 0); ASSERT(bma->idx >= 0);
@ -3056,15 +3062,15 @@ xfs_bmap_add_extent_hole_real(
&i); &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_btree_delete(bma->cur, &i); error = xfs_btree_delete(bma->cur, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_btree_decrement(bma->cur, 0, &i); error = xfs_btree_decrement(bma->cur, 0, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_bmbt_update(bma->cur, left.br_startoff, error = xfs_bmbt_update(bma->cur, left.br_startoff,
left.br_startblock, left.br_startblock,
left.br_blockcount + left.br_blockcount +
@ -3097,7 +3103,7 @@ xfs_bmap_add_extent_hole_real(
&i); &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_bmbt_update(bma->cur, left.br_startoff, error = xfs_bmbt_update(bma->cur, left.br_startoff,
left.br_startblock, left.br_startblock,
left.br_blockcount + left.br_blockcount +
@ -3131,7 +3137,7 @@ xfs_bmap_add_extent_hole_real(
right.br_blockcount, &i); right.br_blockcount, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
error = xfs_bmbt_update(bma->cur, new->br_startoff, error = xfs_bmbt_update(bma->cur, new->br_startoff,
new->br_startblock, new->br_startblock,
new->br_blockcount + new->br_blockcount +
@ -3161,12 +3167,12 @@ xfs_bmap_add_extent_hole_real(
new->br_blockcount, &i); new->br_blockcount, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 0, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
bma->cur->bc_rec.b.br_state = new->br_state; bma->cur->bc_rec.b.br_state = new->br_state;
error = xfs_btree_insert(bma->cur, &i); error = xfs_btree_insert(bma->cur, &i);
if (error) if (error)
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
break; break;
} }
@ -4801,7 +4807,7 @@ xfs_bmap_del_extent(
got.br_startblock, got.br_blockcount, got.br_startblock, got.br_blockcount,
&i))) &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} }
da_old = da_new = 0; da_old = da_new = 0;
} else { } else {
@ -4835,7 +4841,7 @@ xfs_bmap_del_extent(
} }
if ((error = xfs_btree_delete(cur, &i))) if ((error = xfs_btree_delete(cur, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
break; break;
case 2: case 2:
@ -4935,7 +4941,8 @@ xfs_bmap_del_extent(
got.br_startblock, got.br_startblock,
temp, &i))) temp, &i)))
goto done; goto done;
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp,
i == 1, done);
/* /*
* Update the btree record back * Update the btree record back
* to the original value. * to the original value.
@ -4956,7 +4963,7 @@ xfs_bmap_del_extent(
error = -ENOSPC; error = -ENOSPC;
goto done; goto done;
} }
XFS_WANT_CORRUPTED_GOTO(i == 1, done); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
} else } else
flags |= xfs_ilog_fext(whichfork); flags |= xfs_ilog_fext(whichfork);
XFS_IFORK_NEXT_SET(ip, whichfork, XFS_IFORK_NEXT_SET(ip, whichfork,
@ -5453,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);
@ -5487,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;
@ -5521,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;
@ -5528,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
@ -5573,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,

View file

@ -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(
{ {
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(
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;
@ -2285,7 +2285,7 @@ xfs_btree_rshift(
if (error) if (error)
goto error0; goto error0;
i = xfs_btree_lastrec(tcur, level); i = xfs_btree_lastrec(tcur, level);
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
error = xfs_btree_increment(tcur, level, &i); error = xfs_btree_increment(tcur, level, &i);
if (error) if (error)
@ -3138,7 +3138,7 @@ xfs_btree_insert(
goto error0; goto error0;
} }
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
level++; level++;
/* /*
@ -3582,15 +3582,15 @@ xfs_btree_delrec(
* Actually any entry but the first would suffice. * Actually any entry but the first would suffice.
*/ */
i = xfs_btree_lastrec(tcur, level); i = xfs_btree_lastrec(tcur, level);
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
error = xfs_btree_increment(tcur, level, &i); error = xfs_btree_increment(tcur, level, &i);
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
i = xfs_btree_lastrec(tcur, level); i = xfs_btree_lastrec(tcur, level);
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
/* Grab a pointer to the block. */ /* Grab a pointer to the block. */
right = xfs_btree_get_block(tcur, level, &rbp); right = xfs_btree_get_block(tcur, level, &rbp);
@ -3634,12 +3634,12 @@ xfs_btree_delrec(
rrecs = xfs_btree_get_numrecs(right); rrecs = xfs_btree_get_numrecs(right);
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);
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
error = xfs_btree_decrement(tcur, level, &i); error = xfs_btree_decrement(tcur, level, &i);
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
} }
} }
@ -3653,13 +3653,13 @@ xfs_btree_delrec(
* previous block. * previous block.
*/ */
i = xfs_btree_firstrec(tcur, level); i = xfs_btree_firstrec(tcur, level);
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
error = xfs_btree_decrement(tcur, level, &i); error = xfs_btree_decrement(tcur, level, &i);
if (error) if (error)
goto error0; goto error0;
i = xfs_btree_firstrec(tcur, level); i = xfs_btree_firstrec(tcur, level);
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
/* Grab a pointer to the block. */ /* Grab a pointer to the block. */
left = xfs_btree_get_block(tcur, level, &lbp); left = xfs_btree_get_block(tcur, level, &lbp);

View file

@ -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(
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(
* 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(
* 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(
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(
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;
} }

View file

@ -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(
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;
@ -783,12 +783,12 @@ xfs_dialloc_ag_inobt(
error = xfs_inobt_lookup(cur, pagino, XFS_LOOKUP_LE, &i); error = xfs_inobt_lookup(cur, pagino, XFS_LOOKUP_LE, &i);
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
error = xfs_inobt_get_rec(cur, &rec, &j); error = xfs_inobt_get_rec(cur, &rec, &j);
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(j == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, j == 1, error0);
if (rec.ir_freecount > 0) { if (rec.ir_freecount > 0) {
/* /*
@ -944,19 +944,19 @@ 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)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
for (;;) { for (;;) {
error = xfs_inobt_get_rec(cur, &rec, &i); error = xfs_inobt_get_rec(cur, &rec, &i);
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
if (rec.ir_freecount > 0) if (rec.ir_freecount > 0)
break; break;
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_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
} }
alloc_inode: alloc_inode:
@ -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
@ -1039,10 +1039,10 @@ xfs_dialloc_ag_finobt_near(
error = xfs_inobt_get_rec(rcur, &rrec, &j); error = xfs_inobt_get_rec(rcur, &rrec, &j);
if (error) if (error)
goto error_rcur; goto error_rcur;
XFS_WANT_CORRUPTED_GOTO(j == 1, error_rcur); XFS_WANT_CORRUPTED_GOTO(lcur->bc_mp, j == 1, error_rcur);
} }
XFS_WANT_CORRUPTED_GOTO(i == 1 || j == 1, error_rcur); XFS_WANT_CORRUPTED_GOTO(lcur->bc_mp, i == 1 || j == 1, error_rcur);
if (i == 1 && j == 1) { if (i == 1 && j == 1) {
/* /*
* Both the left and right records are valid. Choose the closer * Both the left and right records are valid. Choose the closer
@ -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(
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(
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);
@ -1475,14 +1475,14 @@ xfs_difree_inobt(
__func__, error); __func__, error);
goto error0; goto error0;
} }
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
error = xfs_inobt_get_rec(cur, &rec, &i); error = xfs_inobt_get_rec(cur, &rec, &i);
if (error) { if (error) {
xfs_warn(mp, "%s: xfs_inobt_get_rec() returned error %d.", xfs_warn(mp, "%s: xfs_inobt_get_rec() returned error %d.",
__func__, error); __func__, error);
goto error0; goto error0;
} }
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
/* /*
* Get the offset in the inode chunk. * Get the offset in the inode chunk.
*/ */
@ -1592,7 +1592,7 @@ xfs_difree_finobt(
* freed an inode in a previously fully allocated chunk. If not, * freed an inode in a previously fully allocated chunk. If not,
* something is out of sync. * something is out of sync.
*/ */
XFS_WANT_CORRUPTED_GOTO(ibtrec->ir_freecount == 1, error); XFS_WANT_CORRUPTED_GOTO(mp, ibtrec->ir_freecount == 1, error);
error = xfs_inobt_insert_rec(cur, ibtrec->ir_freecount, error = xfs_inobt_insert_rec(cur, ibtrec->ir_freecount,
ibtrec->ir_free, &i); ibtrec->ir_free, &i);
@ -1613,12 +1613,12 @@ xfs_difree_finobt(
error = xfs_inobt_get_rec(cur, &rec, &i); error = xfs_inobt_get_rec(cur, &rec, &i);
if (error) if (error)
goto error; goto error;
XFS_WANT_CORRUPTED_GOTO(i == 1, error); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error);
rec.ir_free |= XFS_INOBT_MASK(offset); rec.ir_free |= XFS_INOBT_MASK(offset);
rec.ir_freecount++; rec.ir_freecount++;
XFS_WANT_CORRUPTED_GOTO((rec.ir_free == ibtrec->ir_free) && XFS_WANT_CORRUPTED_GOTO(mp, (rec.ir_free == ibtrec->ir_free) &&
(rec.ir_freecount == ibtrec->ir_freecount), (rec.ir_freecount == ibtrec->ir_freecount),
error); error);

View file

@ -111,14 +111,6 @@ xfs_mount_validate_sb(
bool check_inprogress, bool check_inprogress,
bool check_version) bool check_version)
{ {
/*
* If the log device and data device have the
* same device number, the log is internal.
* Consequently, the sb_logstart should be non-zero. If
* we have a zero sb_logstart in this case, we may be trying to mount
* a volume filesystem in a non-volume manner.
*/
if (sbp->sb_magicnum != XFS_SB_MAGIC) { if (sbp->sb_magicnum != XFS_SB_MAGIC) {
xfs_warn(mp, "bad magic number"); xfs_warn(mp, "bad magic number");
return -EWRONGFS; return -EWRONGFS;

View file

@ -537,9 +537,9 @@ xfs_buf_item_push(
/* has a previous flush failed due to IO errors? */ /* has a previous flush failed due to IO errors? */
if ((bp->b_flags & XBF_WRITE_FAIL) && if ((bp->b_flags & XBF_WRITE_FAIL) &&
___ratelimit(&xfs_buf_write_fail_rl_state, "XFS:")) { ___ratelimit(&xfs_buf_write_fail_rl_state, "XFS: Failing async write")) {
xfs_warn(bp->b_target->bt_mount, xfs_warn(bp->b_target->bt_mount,
"Detected failing async write on buffer block 0x%llx. Retrying async write.", "Failing async write on buffer block 0x%llx. Retrying async write.",
(long long)bp->b_bn); (long long)bp->b_bn);
} }

View file

@ -84,7 +84,7 @@ xfs_trim_extents(
error = xfs_alloc_get_rec(cur, &fbno, &flen, &i); error = xfs_alloc_get_rec(cur, &fbno, &flen, &i);
if (error) if (error)
goto out_del_cursor; goto out_del_cursor;
XFS_WANT_CORRUPTED_GOTO(i == 1, out_del_cursor); XFS_WANT_CORRUPTED_GOTO(mp, i == 1, out_del_cursor);
ASSERT(flen <= be32_to_cpu(XFS_BUF_TO_AGF(agbp)->agf_longest)); ASSERT(flen <= be32_to_cpu(XFS_BUF_TO_AGF(agbp)->agf_longest));
/* /*

View file

@ -40,25 +40,25 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
/* /*
* Macros to set EFSCORRUPTED & return/branch. * Macros to set EFSCORRUPTED & return/branch.
*/ */
#define XFS_WANT_CORRUPTED_GOTO(x,l) \ #define XFS_WANT_CORRUPTED_GOTO(mp, x, l) \
{ \ { \
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_GOTO", \ XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_GOTO", \
XFS_ERRLEVEL_LOW, NULL); \ XFS_ERRLEVEL_LOW, mp); \
error = -EFSCORRUPTED; \ error = -EFSCORRUPTED; \
goto l; \ goto l; \
} \ } \
} }
#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; \
} \ } \
} }

View file

@ -439,11 +439,11 @@ again:
*ipp = ip; *ipp = ip;
/* /*
* If we have a real type for an on-disk inode, we can set ops(&unlock) * If we have a real type for an on-disk inode, we can setup the inode
* now. If it's a new inode being created, xfs_ialloc will handle it. * now. If it's a new inode being created, xfs_ialloc will handle it.
*/ */
if (xfs_iflags_test(ip, XFS_INEW) && ip->i_d.di_mode != 0) if (xfs_iflags_test(ip, XFS_INEW) && ip->i_d.di_mode != 0)
xfs_setup_inode(ip); xfs_setup_existing_inode(ip);
return 0; return 0;
out_error_or_again: out_error_or_again:

View file

@ -818,7 +818,7 @@ xfs_ialloc(
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
xfs_trans_log_inode(tp, ip, flags); xfs_trans_log_inode(tp, ip, flags);
/* now that we have an i_mode we can setup inode ops and unlock */ /* now that we have an i_mode we can setup the inode structure */
xfs_setup_inode(ip); xfs_setup_inode(ip);
*ipp = ip; *ipp = ip;
@ -1235,12 +1235,14 @@ xfs_create(
xfs_trans_cancel(tp, cancel_flags); xfs_trans_cancel(tp, cancel_flags);
out_release_inode: out_release_inode:
/* /*
* Wait until after the current transaction is aborted to * Wait until after the current transaction is aborted to finish the
* release the inode. This prevents recursive transactions * setup of the inode and release the inode. This prevents recursive
* and deadlocks from xfs_inactive. * transactions and deadlocks from xfs_inactive.
*/ */
if (ip) if (ip) {
xfs_finish_inode_setup(ip);
IRELE(ip); IRELE(ip);
}
xfs_qm_dqrele(udqp); xfs_qm_dqrele(udqp);
xfs_qm_dqrele(gdqp); xfs_qm_dqrele(gdqp);
@ -1345,12 +1347,14 @@ xfs_create_tmpfile(
xfs_trans_cancel(tp, cancel_flags); xfs_trans_cancel(tp, cancel_flags);
out_release_inode: out_release_inode:
/* /*
* Wait until after the current transaction is aborted to * Wait until after the current transaction is aborted to finish the
* release the inode. This prevents recursive transactions * setup of the inode and release the inode. This prevents recursive
* and deadlocks from xfs_inactive. * transactions and deadlocks from xfs_inactive.
*/ */
if (ip) if (ip) {
xfs_finish_inode_setup(ip);
IRELE(ip); IRELE(ip);
}
xfs_qm_dqrele(udqp); xfs_qm_dqrele(udqp);
xfs_qm_dqrele(gdqp); xfs_qm_dqrele(gdqp);

View file

@ -391,6 +391,28 @@ int xfs_zero_eof(struct xfs_inode *ip, xfs_off_t offset,
int xfs_iozero(struct xfs_inode *ip, loff_t pos, size_t count); int xfs_iozero(struct xfs_inode *ip, loff_t pos, size_t count);
/* from xfs_iops.c */
/*
* When setting up a newly allocated inode, we need to call
* xfs_finish_inode_setup() once the inode is fully instantiated at
* the VFS level to prevent the rest of the world seeing the inode
* before we've completed instantiation. Otherwise we can do it
* the moment the inode lookup is complete.
*/
extern void xfs_setup_inode(struct xfs_inode *ip);
static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
{
xfs_iflags_clear(ip, XFS_INEW);
barrier();
unlock_new_inode(VFS_I(ip));
}
static inline void xfs_setup_existing_inode(struct xfs_inode *ip)
{
xfs_setup_inode(ip);
xfs_finish_inode_setup(ip);
}
#define IHOLD(ip) \ #define IHOLD(ip) \
do { \ do { \
ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \ ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \

View file

@ -187,6 +187,8 @@ xfs_generic_create(
else else
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
xfs_finish_inode_setup(ip);
out_free_acl: out_free_acl:
if (default_acl) if (default_acl)
posix_acl_release(default_acl); posix_acl_release(default_acl);
@ -195,6 +197,7 @@ xfs_generic_create(
return error; return error;
out_cleanup_inode: out_cleanup_inode:
xfs_finish_inode_setup(ip);
if (!tmpfile) if (!tmpfile)
xfs_cleanup_inode(dir, inode, dentry); xfs_cleanup_inode(dir, inode, dentry);
iput(inode); iput(inode);
@ -367,9 +370,11 @@ xfs_vn_symlink(
goto out_cleanup_inode; goto out_cleanup_inode;
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
xfs_finish_inode_setup(cip);
return 0; return 0;
out_cleanup_inode: out_cleanup_inode:
xfs_finish_inode_setup(cip);
xfs_cleanup_inode(dir, inode, dentry); xfs_cleanup_inode(dir, inode, dentry);
iput(inode); iput(inode);
out: out:
@ -1228,16 +1233,12 @@ xfs_diflags_to_iflags(
} }
/* /*
* Initialize the Linux inode, set up the operation vectors and * Initialize the Linux inode and set up the operation vectors.
* unlock the inode.
* *
* When reading existing inodes from disk this is called directly * When reading existing inodes from disk this is called directly from xfs_iget,
* from xfs_iget, when creating a new inode it is called from * when creating a new inode it is called from xfs_ialloc after setting up the
* xfs_ialloc after setting up the inode. * inode. These callers have different criteria for clearing XFS_INEW, so leave
* * it up to the caller to deal with unlocking the inode appropriately.
* We are always called with an uninitialised linux inode here.
* We need to initialise the necessary fields and take a reference
* on it.
*/ */
void void
xfs_setup_inode( xfs_setup_inode(
@ -1324,9 +1325,4 @@ xfs_setup_inode(
inode_has_no_xattr(inode); inode_has_no_xattr(inode);
cache_no_acl(inode); cache_no_acl(inode);
} }
xfs_iflags_clear(ip, XFS_INEW);
barrier();
unlock_new_inode(inode);
} }

View file

@ -25,8 +25,6 @@ extern const struct file_operations xfs_dir_file_operations;
extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size); extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size);
extern void xfs_setup_inode(struct xfs_inode *);
/* /*
* Internal setattr interfaces. * Internal setattr interfaces.
*/ */

View file

@ -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) {

View file

@ -719,6 +719,7 @@ xfs_qm_qino_alloc(
xfs_trans_t *tp; xfs_trans_t *tp;
int error; int error;
int committed; int committed;
bool need_alloc = true;
*ip = NULL; *ip = NULL;
/* /*
@ -747,6 +748,7 @@ xfs_qm_qino_alloc(
return error; return error;
mp->m_sb.sb_gquotino = NULLFSINO; mp->m_sb.sb_gquotino = NULLFSINO;
mp->m_sb.sb_pquotino = NULLFSINO; mp->m_sb.sb_pquotino = NULLFSINO;
need_alloc = false;
} }
} }
@ -758,7 +760,7 @@ xfs_qm_qino_alloc(
return error; return error;
} }
if (!*ip) { if (need_alloc) {
error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, 1, ip, error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, 1, ip,
&committed); &committed);
if (error) { if (error) {
@ -794,11 +796,14 @@ xfs_qm_qino_alloc(
spin_unlock(&mp->m_sb_lock); spin_unlock(&mp->m_sb_lock);
xfs_log_sb(tp); xfs_log_sb(tp);
if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) { error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
if (error) {
ASSERT(XFS_FORCED_SHUTDOWN(mp));
xfs_alert(mp, "%s failed (error %d)!", __func__, error); xfs_alert(mp, "%s failed (error %d)!", __func__, error);
return error;
} }
return 0; if (need_alloc)
xfs_finish_inode_setup(*ip);
return error;
} }

View file

@ -109,8 +109,6 @@ static struct xfs_kobj xfs_dbg_kobj; /* global debug sysfs attrs */
#define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */ #define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */
#define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */ #define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */
#define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */ #define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */
#define MNTOPT_DELAYLOG "delaylog" /* Delayed logging enabled */
#define MNTOPT_NODELAYLOG "nodelaylog" /* Delayed logging disabled */
#define MNTOPT_DISCARD "discard" /* Discard unused blocks */ #define MNTOPT_DISCARD "discard" /* Discard unused blocks */
#define MNTOPT_NODISCARD "nodiscard" /* Do not discard unused blocks */ #define MNTOPT_NODISCARD "nodiscard" /* Do not discard unused blocks */
@ -361,28 +359,10 @@ xfs_parseargs(
} else if (!strcmp(this_char, MNTOPT_GQUOTANOENF)) { } else if (!strcmp(this_char, MNTOPT_GQUOTANOENF)) {
mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE);
mp->m_qflags &= ~XFS_GQUOTA_ENFD; mp->m_qflags &= ~XFS_GQUOTA_ENFD;
} else if (!strcmp(this_char, MNTOPT_DELAYLOG)) {
xfs_warn(mp,
"delaylog is the default now, option is deprecated.");
} else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) {
xfs_warn(mp,
"nodelaylog support has been removed, option is deprecated.");
} else if (!strcmp(this_char, MNTOPT_DISCARD)) { } else if (!strcmp(this_char, MNTOPT_DISCARD)) {
mp->m_flags |= XFS_MOUNT_DISCARD; mp->m_flags |= XFS_MOUNT_DISCARD;
} else if (!strcmp(this_char, MNTOPT_NODISCARD)) { } else if (!strcmp(this_char, MNTOPT_NODISCARD)) {
mp->m_flags &= ~XFS_MOUNT_DISCARD; mp->m_flags &= ~XFS_MOUNT_DISCARD;
} else if (!strcmp(this_char, "ihashsize")) {
xfs_warn(mp,
"ihashsize no longer used, option is deprecated.");
} else if (!strcmp(this_char, "osyncisdsync")) {
xfs_warn(mp,
"osyncisdsync has no effect, option is deprecated.");
} else if (!strcmp(this_char, "osyncisosync")) {
xfs_warn(mp,
"osyncisosync has no effect, option is deprecated.");
} else if (!strcmp(this_char, "irixsgid")) {
xfs_warn(mp,
"irixsgid is now a sysctl(2) variable, option is deprecated.");
} else { } else {
xfs_warn(mp, "unknown mount option [%s].", this_char); xfs_warn(mp, "unknown mount option [%s].", this_char);
return -EINVAL; return -EINVAL;
@ -1039,6 +1019,7 @@ xfs_fs_put_super(
{ {
struct xfs_mount *mp = XFS_M(sb); struct xfs_mount *mp = XFS_M(sb);
xfs_notice(mp, "Unmounting Filesystem");
xfs_filestream_unmount(mp); xfs_filestream_unmount(mp);
xfs_unmountfs(mp); xfs_unmountfs(mp);

View file

@ -177,7 +177,7 @@ xfs_symlink(
int pathlen; int pathlen;
struct xfs_bmap_free free_list; struct xfs_bmap_free free_list;
xfs_fsblock_t first_block; xfs_fsblock_t first_block;
bool unlock_dp_on_error = false; bool unlock_dp_on_error = false;
uint cancel_flags; uint cancel_flags;
int committed; int committed;
xfs_fileoff_t first_fsb; xfs_fileoff_t first_fsb;
@ -221,7 +221,7 @@ xfs_symlink(
XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
&udqp, &gdqp, &pdqp); &udqp, &gdqp, &pdqp);
if (error) if (error)
goto std_return; return error;
tp = xfs_trans_alloc(mp, XFS_TRANS_SYMLINK); tp = xfs_trans_alloc(mp, XFS_TRANS_SYMLINK);
cancel_flags = XFS_TRANS_RELEASE_LOG_RES; cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
@ -241,7 +241,7 @@ xfs_symlink(
} }
if (error) { if (error) {
cancel_flags = 0; cancel_flags = 0;
goto error_return; goto out_trans_cancel;
} }
xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
@ -252,7 +252,7 @@ xfs_symlink(
*/ */
if (dp->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) { if (dp->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) {
error = -EPERM; error = -EPERM;
goto error_return; goto out_trans_cancel;
} }
/* /*
@ -261,7 +261,7 @@ xfs_symlink(
error = xfs_trans_reserve_quota(tp, mp, udqp, gdqp, error = xfs_trans_reserve_quota(tp, mp, udqp, gdqp,
pdqp, resblks, 1, 0); pdqp, resblks, 1, 0);
if (error) if (error)
goto error_return; goto out_trans_cancel;
/* /*
* Check for ability to enter directory entry, if no space reserved. * Check for ability to enter directory entry, if no space reserved.
@ -269,7 +269,7 @@ xfs_symlink(
if (!resblks) { if (!resblks) {
error = xfs_dir_canenter(tp, dp, link_name); error = xfs_dir_canenter(tp, dp, link_name);
if (error) if (error)
goto error_return; goto out_trans_cancel;
} }
/* /*
* Initialize the bmap freelist prior to calling either * Initialize the bmap freelist prior to calling either
@ -282,15 +282,14 @@ xfs_symlink(
*/ */
error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (mode & ~S_IFMT), 1, 0, error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (mode & ~S_IFMT), 1, 0,
prid, resblks > 0, &ip, NULL); prid, resblks > 0, &ip, NULL);
if (error) { if (error)
if (error == -ENOSPC) goto out_trans_cancel;
goto error_return;
goto error1;
}
/* /*
* An error after we've joined dp to the transaction will result in the * Now we join the directory inode to the transaction. We do not do it
* transaction cancel unlocking dp so don't do it explicitly in the * earlier because xfs_dir_ialloc might commit the previous transaction
* (and release all the locks). An error from here on will result in
* the transaction cancel unlocking dp so don't do it explicitly in the
* error path. * error path.
*/ */
xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
@ -330,7 +329,7 @@ xfs_symlink(
XFS_BMAPI_METADATA, &first_block, resblks, XFS_BMAPI_METADATA, &first_block, resblks,
mval, &nmaps, &free_list); mval, &nmaps, &free_list);
if (error) if (error)
goto error2; goto out_bmap_cancel;
if (resblks) if (resblks)
resblks -= fs_blocks; resblks -= fs_blocks;
@ -348,7 +347,7 @@ xfs_symlink(
BTOBB(byte_cnt), 0); BTOBB(byte_cnt), 0);
if (!bp) { if (!bp) {
error = -ENOMEM; error = -ENOMEM;
goto error2; goto out_bmap_cancel;
} }
bp->b_ops = &xfs_symlink_buf_ops; bp->b_ops = &xfs_symlink_buf_ops;
@ -378,7 +377,7 @@ xfs_symlink(
error = xfs_dir_createname(tp, dp, link_name, ip->i_ino, error = xfs_dir_createname(tp, dp, link_name, ip->i_ino,
&first_block, &free_list, resblks); &first_block, &free_list, resblks);
if (error) if (error)
goto error2; goto out_bmap_cancel;
xfs_trans_ichgtime(tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); xfs_trans_ichgtime(tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE); xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
@ -392,10 +391,13 @@ xfs_symlink(
} }
error = xfs_bmap_finish(&tp, &free_list, &committed); error = xfs_bmap_finish(&tp, &free_list, &committed);
if (error) { if (error)
goto error2; goto out_bmap_cancel;
}
error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
if (error)
goto out_release_inode;
xfs_qm_dqrele(udqp); xfs_qm_dqrele(udqp);
xfs_qm_dqrele(gdqp); xfs_qm_dqrele(gdqp);
xfs_qm_dqrele(pdqp); xfs_qm_dqrele(pdqp);
@ -403,20 +405,28 @@ xfs_symlink(
*ipp = ip; *ipp = ip;
return 0; return 0;
error2: out_bmap_cancel:
IRELE(ip);
error1:
xfs_bmap_cancel(&free_list); xfs_bmap_cancel(&free_list);
cancel_flags |= XFS_TRANS_ABORT; cancel_flags |= XFS_TRANS_ABORT;
error_return: out_trans_cancel:
xfs_trans_cancel(tp, cancel_flags); xfs_trans_cancel(tp, cancel_flags);
out_release_inode:
/*
* Wait until after the current transaction is aborted to finish the
* setup of the inode and release the inode. This prevents recursive
* transactions and deadlocks from xfs_inactive.
*/
if (ip) {
xfs_finish_inode_setup(ip);
IRELE(ip);
}
xfs_qm_dqrele(udqp); xfs_qm_dqrele(udqp);
xfs_qm_dqrele(gdqp); xfs_qm_dqrele(gdqp);
xfs_qm_dqrele(pdqp); xfs_qm_dqrele(pdqp);
if (unlock_dp_on_error) if (unlock_dp_on_error)
xfs_iunlock(dp, XFS_ILOCK_EXCL); xfs_iunlock(dp, XFS_ILOCK_EXCL);
std_return:
return error; return error;
} }