aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2014-06-22 01:04:54 -0400
committerDave Chinner <david@fromorbit.com>2014-06-22 01:04:54 -0400
commitb474c7ae4395ba684e85fde8f55c8cf44a39afaf (patch)
treea7d3cad895a9e1f14894710b43e9ccbf634da3f1
parentd99831ff393ff2e28d6110b41f24d9fecf986222 (diff)
xfs: Nuke XFS_ERROR macro
XFS_ERROR was designed long ago to trap return values, but it's not runtime configurable, it's not consistently used, and we can do similar error trapping with ftrace scripts and triggers from userspace. Just nuke XFS_ERROR and associated bits. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_aops.c10
-rw-r--r--fs/xfs/xfs_attr.c6
-rw-r--r--fs/xfs/xfs_attr_inactive.c6
-rw-r--r--fs/xfs/xfs_attr_leaf.c28
-rw-r--r--fs/xfs/xfs_attr_list.c14
-rw-r--r--fs/xfs/xfs_bmap.c42
-rw-r--r--fs/xfs/xfs_bmap_btree.c2
-rw-r--r--fs/xfs/xfs_bmap_util.c44
-rw-r--r--fs/xfs/xfs_btree.c4
-rw-r--r--fs/xfs/xfs_da_btree.c26
-rw-r--r--fs/xfs/xfs_dir2.c2
-rw-r--r--fs/xfs/xfs_dir2_block.c12
-rw-r--r--fs/xfs/xfs_dir2_leaf.c10
-rw-r--r--fs/xfs/xfs_dir2_node.c16
-rw-r--r--fs/xfs/xfs_dir2_readdir.c4
-rw-r--r--fs/xfs/xfs_dir2_sf.c24
-rw-r--r--fs/xfs/xfs_discard.c10
-rw-r--r--fs/xfs/xfs_dquot.c14
-rw-r--r--fs/xfs/xfs_error.c23
-rw-r--r--fs/xfs/xfs_error.h13
-rw-r--r--fs/xfs/xfs_file.c8
-rw-r--r--fs/xfs/xfs_fsops.c20
-rw-r--r--fs/xfs/xfs_ialloc.c16
-rw-r--r--fs/xfs/xfs_icache.c6
-rw-r--r--fs/xfs/xfs_inode.c30
-rw-r--r--fs/xfs/xfs_inode_buf.c4
-rw-r--r--fs/xfs/xfs_inode_fork.c30
-rw-r--r--fs/xfs/xfs_ioctl.c174
-rw-r--r--fs/xfs/xfs_ioctl32.c82
-rw-r--r--fs/xfs/xfs_iomap.c26
-rw-r--r--fs/xfs/xfs_iops.c18
-rw-r--r--fs/xfs/xfs_itable.c14
-rw-r--r--fs/xfs/xfs_log.c32
-rw-r--r--fs/xfs/xfs_log_cil.c2
-rw-r--r--fs/xfs/xfs_log_recover.c70
-rw-r--r--fs/xfs/xfs_mount.c48
-rw-r--r--fs/xfs/xfs_qm.c6
-rw-r--r--fs/xfs/xfs_qm_bhv.c2
-rw-r--r--fs/xfs/xfs_qm_syscalls.c16
-rw-r--r--fs/xfs/xfs_rtalloc.c14
-rw-r--r--fs/xfs/xfs_sb.c26
-rw-r--r--fs/xfs/xfs_super.c16
-rw-r--r--fs/xfs/xfs_symlink.c16
-rw-r--r--fs/xfs/xfs_trans.c8
-rw-r--r--fs/xfs/xfs_trans_buf.c12
45 files changed, 487 insertions, 519 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index faaf716e2080..eb67f416b13a 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -308,14 +308,14 @@ xfs_map_blocks(
308 int nimaps = 1; 308 int nimaps = 1;
309 309
310 if (XFS_FORCED_SHUTDOWN(mp)) 310 if (XFS_FORCED_SHUTDOWN(mp))
311 return -XFS_ERROR(EIO); 311 return -EIO;
312 312
313 if (type == XFS_IO_UNWRITTEN) 313 if (type == XFS_IO_UNWRITTEN)
314 bmapi_flags |= XFS_BMAPI_IGSTATE; 314 bmapi_flags |= XFS_BMAPI_IGSTATE;
315 315
316 if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) { 316 if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
317 if (nonblocking) 317 if (nonblocking)
318 return -XFS_ERROR(EAGAIN); 318 return -EAGAIN;
319 xfs_ilock(ip, XFS_ILOCK_SHARED); 319 xfs_ilock(ip, XFS_ILOCK_SHARED);
320 } 320 }
321 321
@@ -332,14 +332,14 @@ xfs_map_blocks(
332 xfs_iunlock(ip, XFS_ILOCK_SHARED); 332 xfs_iunlock(ip, XFS_ILOCK_SHARED);
333 333
334 if (error) 334 if (error)
335 return -XFS_ERROR(error); 335 return -error;
336 336
337 if (type == XFS_IO_DELALLOC && 337 if (type == XFS_IO_DELALLOC &&
338 (!nimaps || isnullstartblock(imap->br_startblock))) { 338 (!nimaps || isnullstartblock(imap->br_startblock))) {
339 error = xfs_iomap_write_allocate(ip, offset, imap); 339 error = xfs_iomap_write_allocate(ip, offset, imap);
340 if (!error) 340 if (!error)
341 trace_xfs_map_blocks_alloc(ip, offset, count, type, imap); 341 trace_xfs_map_blocks_alloc(ip, offset, count, type, imap);
342 return -XFS_ERROR(error); 342 return -error;
343 } 343 }
344 344
345#ifdef DEBUG 345#ifdef DEBUG
@@ -1253,7 +1253,7 @@ __xfs_get_blocks(
1253 int new = 0; 1253 int new = 0;
1254 1254
1255 if (XFS_FORCED_SHUTDOWN(mp)) 1255 if (XFS_FORCED_SHUTDOWN(mp))
1256 return -XFS_ERROR(EIO); 1256 return -EIO;
1257 1257
1258 offset = (xfs_off_t)iblock << inode->i_blkbits; 1258 offset = (xfs_off_t)iblock << inode->i_blkbits;
1259 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); 1259 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 4cd541891a60..7d95b16f0919 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -477,7 +477,7 @@ xfs_attr_remove(
477 xfs_trans_ijoin(args.trans, dp, 0); 477 xfs_trans_ijoin(args.trans, dp, 0);
478 478
479 if (!xfs_inode_hasattr(dp)) { 479 if (!xfs_inode_hasattr(dp)) {
480 error = XFS_ERROR(ENOATTR); 480 error = ENOATTR;
481 } else if (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { 481 } else if (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) {
482 ASSERT(dp->i_afp->if_flags & XFS_IFINLINE); 482 ASSERT(dp->i_afp->if_flags & XFS_IFINLINE);
483 error = xfs_attr_shortform_remove(&args); 483 error = xfs_attr_shortform_remove(&args);
@@ -545,14 +545,14 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
545 545
546 if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX || 546 if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
547 args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX) 547 args->valuelen >= XFS_ATTR_SF_ENTSIZE_MAX)
548 return XFS_ERROR(ENOSPC); 548 return ENOSPC;
549 549
550 newsize = XFS_ATTR_SF_TOTSIZE(args->dp); 550 newsize = XFS_ATTR_SF_TOTSIZE(args->dp);
551 newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen); 551 newsize += XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
552 552
553 forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize); 553 forkoff = xfs_attr_shortform_bytesfit(args->dp, newsize);
554 if (!forkoff) 554 if (!forkoff)
555 return XFS_ERROR(ENOSPC); 555 return ENOSPC;
556 556
557 xfs_attr_shortform_add(args, forkoff); 557 xfs_attr_shortform_add(args, forkoff);
558 return 0; 558 return 0;
diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c
index b39e58823085..f19d1ef1f84a 100644
--- a/fs/xfs/xfs_attr_inactive.c
+++ b/fs/xfs/xfs_attr_inactive.c
@@ -227,7 +227,7 @@ xfs_attr3_node_inactive(
227 */ 227 */
228 if (level > XFS_DA_NODE_MAXDEPTH) { 228 if (level > XFS_DA_NODE_MAXDEPTH) {
229 xfs_trans_brelse(*trans, bp); /* no locks for later trans */ 229 xfs_trans_brelse(*trans, bp); /* no locks for later trans */
230 return XFS_ERROR(EIO); 230 return EIO;
231 } 231 }
232 232
233 node = bp->b_addr; 233 node = bp->b_addr;
@@ -277,7 +277,7 @@ xfs_attr3_node_inactive(
277 child_bp); 277 child_bp);
278 break; 278 break;
279 default: 279 default:
280 error = XFS_ERROR(EIO); 280 error = EIO;
281 xfs_trans_brelse(*trans, child_bp); 281 xfs_trans_brelse(*trans, child_bp);
282 break; 282 break;
283 } 283 }
@@ -360,7 +360,7 @@ xfs_attr3_root_inactive(
360 error = xfs_attr3_leaf_inactive(trans, dp, bp); 360 error = xfs_attr3_leaf_inactive(trans, dp, bp);
361 break; 361 break;
362 default: 362 default:
363 error = XFS_ERROR(EIO); 363 error = EIO;
364 xfs_trans_brelse(*trans, bp); 364 xfs_trans_brelse(*trans, bp);
365 break; 365 break;
366 } 366 }
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index d2ce4013084c..127d96aba845 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -547,7 +547,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
547 break; 547 break;
548 } 548 }
549 if (i == end) 549 if (i == end)
550 return XFS_ERROR(ENOATTR); 550 return ENOATTR;
551 551
552 /* 552 /*
553 * Fix up the attribute fork data, covering the hole 553 * Fix up the attribute fork data, covering the hole
@@ -611,9 +611,9 @@ xfs_attr_shortform_lookup(xfs_da_args_t *args)
611 continue; 611 continue;
612 if (!xfs_attr_namesp_match(args->flags, sfe->flags)) 612 if (!xfs_attr_namesp_match(args->flags, sfe->flags))
613 continue; 613 continue;
614 return XFS_ERROR(EEXIST); 614 return EEXIST;
615 } 615 }
616 return XFS_ERROR(ENOATTR); 616 return ENOATTR;
617} 617}
618 618
619/* 619/*
@@ -640,18 +640,18 @@ xfs_attr_shortform_getvalue(xfs_da_args_t *args)
640 continue; 640 continue;
641 if (args->flags & ATTR_KERNOVAL) { 641 if (args->flags & ATTR_KERNOVAL) {
642 args->valuelen = sfe->valuelen; 642 args->valuelen = sfe->valuelen;
643 return XFS_ERROR(EEXIST); 643 return EEXIST;
644 } 644 }
645 if (args->valuelen < sfe->valuelen) { 645 if (args->valuelen < sfe->valuelen) {
646 args->valuelen = sfe->valuelen; 646 args->valuelen = sfe->valuelen;
647 return XFS_ERROR(ERANGE); 647 return ERANGE;
648 } 648 }
649 args->valuelen = sfe->valuelen; 649 args->valuelen = sfe->valuelen;
650 memcpy(args->value, &sfe->nameval[args->namelen], 650 memcpy(args->value, &sfe->nameval[args->namelen],
651 args->valuelen); 651 args->valuelen);
652 return XFS_ERROR(EEXIST); 652 return EEXIST;
653 } 653 }
654 return XFS_ERROR(ENOATTR); 654 return ENOATTR;
655} 655}
656 656
657/* 657/*
@@ -1108,7 +1108,7 @@ xfs_attr3_leaf_add(
1108 * no good and we should just give up. 1108 * no good and we should just give up.
1109 */ 1109 */
1110 if (!ichdr.holes && sum < entsize) 1110 if (!ichdr.holes && sum < entsize)
1111 return XFS_ERROR(ENOSPC); 1111 return ENOSPC;
1112 1112
1113 /* 1113 /*
1114 * Compact the entries to coalesce free space. 1114 * Compact the entries to coalesce free space.
@@ -2123,7 +2123,7 @@ xfs_attr3_leaf_lookup_int(
2123 } 2123 }
2124 if (probe == ichdr.count || be32_to_cpu(entry->hashval) != hashval) { 2124 if (probe == ichdr.count || be32_to_cpu(entry->hashval) != hashval) {
2125 args->index = probe; 2125 args->index = probe;
2126 return XFS_ERROR(ENOATTR); 2126 return ENOATTR;
2127 } 2127 }
2128 2128
2129 /* 2129 /*
@@ -2152,7 +2152,7 @@ xfs_attr3_leaf_lookup_int(
2152 if (!xfs_attr_namesp_match(args->flags, entry->flags)) 2152 if (!xfs_attr_namesp_match(args->flags, entry->flags))
2153 continue; 2153 continue;
2154 args->index = probe; 2154 args->index = probe;
2155 return XFS_ERROR(EEXIST); 2155 return EEXIST;
2156 } else { 2156 } else {
2157 name_rmt = xfs_attr3_leaf_name_remote(leaf, probe); 2157 name_rmt = xfs_attr3_leaf_name_remote(leaf, probe);
2158 if (name_rmt->namelen != args->namelen) 2158 if (name_rmt->namelen != args->namelen)
@@ -2168,11 +2168,11 @@ xfs_attr3_leaf_lookup_int(
2168 args->rmtblkcnt = xfs_attr3_rmt_blocks( 2168 args->rmtblkcnt = xfs_attr3_rmt_blocks(
2169 args->dp->i_mount, 2169 args->dp->i_mount,
2170 args->rmtvaluelen); 2170 args->rmtvaluelen);
2171 return XFS_ERROR(EEXIST); 2171 return EEXIST;
2172 } 2172 }
2173 } 2173 }
2174 args->index = probe; 2174 args->index = probe;
2175 return XFS_ERROR(ENOATTR); 2175 return ENOATTR;
2176} 2176}
2177 2177
2178/* 2178/*
@@ -2208,7 +2208,7 @@ xfs_attr3_leaf_getvalue(
2208 } 2208 }
2209 if (args->valuelen < valuelen) { 2209 if (args->valuelen < valuelen) {
2210 args->valuelen = valuelen; 2210 args->valuelen = valuelen;
2211 return XFS_ERROR(ERANGE); 2211 return ERANGE;
2212 } 2212 }
2213 args->valuelen = valuelen; 2213 args->valuelen = valuelen;
2214 memcpy(args->value, &name_loc->nameval[args->namelen], valuelen); 2214 memcpy(args->value, &name_loc->nameval[args->namelen], valuelen);
@@ -2226,7 +2226,7 @@ xfs_attr3_leaf_getvalue(
2226 } 2226 }
2227 if (args->valuelen < args->rmtvaluelen) { 2227 if (args->valuelen < args->rmtvaluelen) {
2228 args->valuelen = args->rmtvaluelen; 2228 args->valuelen = args->rmtvaluelen;
2229 return XFS_ERROR(ERANGE); 2229 return ERANGE;
2230 } 2230 }
2231 args->valuelen = args->rmtvaluelen; 2231 args->valuelen = args->rmtvaluelen;
2232 } 2232 }
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index 2d5487b6194c..84ea231e0da4 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -150,7 +150,7 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
150 XFS_ERRLEVEL_LOW, 150 XFS_ERRLEVEL_LOW,
151 context->dp->i_mount, sfe); 151 context->dp->i_mount, sfe);
152 kmem_free(sbuf); 152 kmem_free(sbuf);
153 return XFS_ERROR(EFSCORRUPTED); 153 return EFSCORRUPTED;
154 } 154 }
155 155
156 sbp->entno = i; 156 sbp->entno = i;
@@ -308,7 +308,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
308 context->dp->i_mount, 308 context->dp->i_mount,
309 node); 309 node);
310 xfs_trans_brelse(NULL, bp); 310 xfs_trans_brelse(NULL, bp);
311 return XFS_ERROR(EFSCORRUPTED); 311 return EFSCORRUPTED;
312 } 312 }
313 313
314 dp->d_ops->node_hdr_from_disk(&nodehdr, node); 314 dp->d_ops->node_hdr_from_disk(&nodehdr, node);
@@ -496,11 +496,11 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context)
496 context->cursor->blkno = 0; 496 context->cursor->blkno = 0;
497 error = xfs_attr3_leaf_read(NULL, context->dp, 0, -1, &bp); 497 error = xfs_attr3_leaf_read(NULL, context->dp, 0, -1, &bp);
498 if (error) 498 if (error)
499 return XFS_ERROR(error); 499 return error;
500 500
501 error = xfs_attr3_leaf_list_int(bp, context); 501 error = xfs_attr3_leaf_list_int(bp, context);
502 xfs_trans_brelse(NULL, bp); 502 xfs_trans_brelse(NULL, bp);
503 return XFS_ERROR(error); 503 return error;
504} 504}
505 505
506int 506int
@@ -616,16 +616,16 @@ xfs_attr_list(
616 * Validate the cursor. 616 * Validate the cursor.
617 */ 617 */
618 if (cursor->pad1 || cursor->pad2) 618 if (cursor->pad1 || cursor->pad2)
619 return XFS_ERROR(EINVAL); 619 return EINVAL;
620 if ((cursor->initted == 0) && 620 if ((cursor->initted == 0) &&
621 (cursor->hashval || cursor->blkno || cursor->offset)) 621 (cursor->hashval || cursor->blkno || cursor->offset))
622 return XFS_ERROR(EINVAL); 622 return EINVAL;
623 623
624 /* 624 /*
625 * Check for a properly aligned buffer. 625 * Check for a properly aligned buffer.
626 */ 626 */
627 if (((long)buffer) & (sizeof(int)-1)) 627 if (((long)buffer) & (sizeof(int)-1))
628 return XFS_ERROR(EFAULT); 628 return EFAULT;
629 if (flags & ATTR_KERNOVAL) 629 if (flags & ATTR_KERNOVAL)
630 bufsize = 0; 630 bufsize = 0;
631 631
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 96175df211b1..b44d63189dab 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -1033,7 +1033,7 @@ xfs_bmap_add_attrfork_btree(
1033 goto error0; 1033 goto error0;
1034 if (stat == 0) { 1034 if (stat == 0) {
1035 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); 1035 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
1036 return XFS_ERROR(ENOSPC); 1036 return ENOSPC;
1037 } 1037 }
1038 *firstblock = cur->bc_private.b.firstblock; 1038 *firstblock = cur->bc_private.b.firstblock;
1039 cur->bc_private.b.allocated = 0; 1039 cur->bc_private.b.allocated = 0;
@@ -1192,7 +1192,7 @@ xfs_bmap_add_attrfork(
1192 break; 1192 break;
1193 default: 1193 default:
1194 ASSERT(0); 1194 ASSERT(0);
1195 error = XFS_ERROR(EINVAL); 1195 error = EINVAL;
1196 goto trans_cancel; 1196 goto trans_cancel;
1197 } 1197 }
1198 1198
@@ -1399,7 +1399,7 @@ xfs_bmap_read_extents(
1399 return 0; 1399 return 0;
1400error0: 1400error0:
1401 xfs_trans_brelse(tp, bp); 1401 xfs_trans_brelse(tp, bp);
1402 return XFS_ERROR(EFSCORRUPTED); 1402 return EFSCORRUPTED;
1403} 1403}
1404 1404
1405 1405
@@ -1576,7 +1576,7 @@ xfs_bmap_last_before(
1576 if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && 1576 if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
1577 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && 1577 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&
1578 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL) 1578 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL)
1579 return XFS_ERROR(EIO); 1579 return EIO;
1580 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) { 1580 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) {
1581 *last_block = 0; 1581 *last_block = 0;
1582 return 0; 1582 return 0;
@@ -1690,7 +1690,7 @@ xfs_bmap_last_offset(
1690 1690
1691 if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && 1691 if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
1692 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS) 1692 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS)
1693 return XFS_ERROR(EIO); 1693 return EIO;
1694 1694
1695 error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty); 1695 error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty);
1696 if (error || is_empty) 1696 if (error || is_empty)
@@ -3323,7 +3323,7 @@ xfs_bmap_extsize_align(
3323 if (orig_off < align_off || 3323 if (orig_off < align_off ||
3324 orig_end > align_off + align_alen || 3324 orig_end > align_off + align_alen ||
3325 align_alen - temp < orig_alen) 3325 align_alen - temp < orig_alen)
3326 return XFS_ERROR(EINVAL); 3326 return EINVAL;
3327 /* 3327 /*
3328 * Try to fix it by moving the start up. 3328 * Try to fix it by moving the start up.
3329 */ 3329 */
@@ -3348,7 +3348,7 @@ xfs_bmap_extsize_align(
3348 * Result doesn't cover the request, fail it. 3348 * Result doesn't cover the request, fail it.
3349 */ 3349 */
3350 if (orig_off < align_off || orig_end > align_off + align_alen) 3350 if (orig_off < align_off || orig_end > align_off + align_alen)
3351 return XFS_ERROR(EINVAL); 3351 return EINVAL;
3352 } else { 3352 } else {
3353 ASSERT(orig_off >= align_off); 3353 ASSERT(orig_off >= align_off);
3354 ASSERT(orig_end <= align_off + align_alen); 3354 ASSERT(orig_end <= align_off + align_alen);
@@ -4051,11 +4051,11 @@ xfs_bmapi_read(
4051 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE), 4051 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE),
4052 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { 4052 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
4053 XFS_ERROR_REPORT("xfs_bmapi_read", XFS_ERRLEVEL_LOW, mp); 4053 XFS_ERROR_REPORT("xfs_bmapi_read", XFS_ERRLEVEL_LOW, mp);
4054 return XFS_ERROR(EFSCORRUPTED); 4054 return EFSCORRUPTED;
4055 } 4055 }
4056 4056
4057 if (XFS_FORCED_SHUTDOWN(mp)) 4057 if (XFS_FORCED_SHUTDOWN(mp))
4058 return XFS_ERROR(EIO); 4058 return EIO;
4059 4059
4060 XFS_STATS_INC(xs_blk_mapr); 4060 XFS_STATS_INC(xs_blk_mapr);
4061 4061
@@ -4246,11 +4246,11 @@ xfs_bmapi_delay(
4246 XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) != XFS_DINODE_FMT_BTREE), 4246 XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) != XFS_DINODE_FMT_BTREE),
4247 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { 4247 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
4248 XFS_ERROR_REPORT("xfs_bmapi_delay", XFS_ERRLEVEL_LOW, mp); 4248 XFS_ERROR_REPORT("xfs_bmapi_delay", XFS_ERRLEVEL_LOW, mp);
4249 return XFS_ERROR(EFSCORRUPTED); 4249 return EFSCORRUPTED;
4250 } 4250 }
4251 4251
4252 if (XFS_FORCED_SHUTDOWN(mp)) 4252 if (XFS_FORCED_SHUTDOWN(mp))
4253 return XFS_ERROR(EIO); 4253 return EIO;
4254 4254
4255 XFS_STATS_INC(xs_blk_mapw); 4255 XFS_STATS_INC(xs_blk_mapw);
4256 4256
@@ -4540,11 +4540,11 @@ xfs_bmapi_write(
4540 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE), 4540 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE),
4541 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { 4541 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
4542 XFS_ERROR_REPORT("xfs_bmapi_write", XFS_ERRLEVEL_LOW, mp); 4542 XFS_ERROR_REPORT("xfs_bmapi_write", XFS_ERRLEVEL_LOW, mp);
4543 return XFS_ERROR(EFSCORRUPTED); 4543 return EFSCORRUPTED;
4544 } 4544 }
4545 4545
4546 if (XFS_FORCED_SHUTDOWN(mp)) 4546 if (XFS_FORCED_SHUTDOWN(mp))
4547 return XFS_ERROR(EIO); 4547 return EIO;
4548 4548
4549 ifp = XFS_IFORK_PTR(ip, whichfork); 4549 ifp = XFS_IFORK_PTR(ip, whichfork);
4550 4550
@@ -4961,7 +4961,7 @@ xfs_bmap_del_extent(
4961 xfs_bmbt_set_blockcount(ep, 4961 xfs_bmbt_set_blockcount(ep,
4962 got.br_blockcount); 4962 got.br_blockcount);
4963 flags = 0; 4963 flags = 0;
4964 error = XFS_ERROR(ENOSPC); 4964 error = ENOSPC;
4965 goto done; 4965 goto done;
4966 } 4966 }
4967 XFS_WANT_CORRUPTED_GOTO(i == 1, done); 4967 XFS_WANT_CORRUPTED_GOTO(i == 1, done);
@@ -5079,11 +5079,11 @@ xfs_bunmapi(
5079 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) { 5079 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) {
5080 XFS_ERROR_REPORT("xfs_bunmapi", XFS_ERRLEVEL_LOW, 5080 XFS_ERROR_REPORT("xfs_bunmapi", XFS_ERRLEVEL_LOW,
5081 ip->i_mount); 5081 ip->i_mount);
5082 return XFS_ERROR(EFSCORRUPTED); 5082 return EFSCORRUPTED;
5083 } 5083 }
5084 mp = ip->i_mount; 5084 mp = ip->i_mount;
5085 if (XFS_FORCED_SHUTDOWN(mp)) 5085 if (XFS_FORCED_SHUTDOWN(mp))
5086 return XFS_ERROR(EIO); 5086 return EIO;
5087 5087
5088 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); 5088 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
5089 ASSERT(len > 0); 5089 ASSERT(len > 0);
@@ -5328,7 +5328,7 @@ xfs_bunmapi(
5328 del.br_startoff > got.br_startoff && 5328 del.br_startoff > got.br_startoff &&
5329 del.br_startoff + del.br_blockcount < 5329 del.br_startoff + del.br_blockcount <
5330 got.br_startoff + got.br_blockcount) { 5330 got.br_startoff + got.br_blockcount) {
5331 error = XFS_ERROR(ENOSPC); 5331 error = ENOSPC;
5332 goto error0; 5332 goto error0;
5333 } 5333 }
5334 error = xfs_bmap_del_extent(ip, tp, &lastx, flist, cur, &del, 5334 error = xfs_bmap_del_extent(ip, tp, &lastx, flist, cur, &del,
@@ -5452,11 +5452,11 @@ xfs_bmap_shift_extents(
5452 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) { 5452 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
5453 XFS_ERROR_REPORT("xfs_bmap_shift_extents", 5453 XFS_ERROR_REPORT("xfs_bmap_shift_extents",
5454 XFS_ERRLEVEL_LOW, mp); 5454 XFS_ERRLEVEL_LOW, mp);
5455 return XFS_ERROR(EFSCORRUPTED); 5455 return EFSCORRUPTED;
5456 } 5456 }
5457 5457
5458 if (XFS_FORCED_SHUTDOWN(mp)) 5458 if (XFS_FORCED_SHUTDOWN(mp))
5459 return XFS_ERROR(EIO); 5459 return EIO;
5460 5460
5461 ASSERT(current_ext != NULL); 5461 ASSERT(current_ext != NULL);
5462 5462
@@ -5519,14 +5519,14 @@ xfs_bmap_shift_extents(
5519 *current_ext - 1), &left); 5519 *current_ext - 1), &left);
5520 5520
5521 if (startoff < left.br_startoff + left.br_blockcount) 5521 if (startoff < left.br_startoff + left.br_blockcount)
5522 error = XFS_ERROR(EINVAL); 5522 error = EINVAL;
5523 } else if (offset_shift_fsb > got.br_startoff) { 5523 } else if (offset_shift_fsb > got.br_startoff) {
5524 /* 5524 /*
5525 * When first extent is shifted, offset_shift_fsb 5525 * When first extent is shifted, offset_shift_fsb
5526 * should be less than the stating offset of 5526 * should be less than the stating offset of
5527 * the first extent. 5527 * the first extent.
5528 */ 5528 */
5529 error = XFS_ERROR(EINVAL); 5529 error = EINVAL;
5530 } 5530 }
5531 5531
5532 if (error) 5532 if (error)
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 948836c4fd90..de65bb8bab04 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -554,7 +554,7 @@ xfs_bmbt_alloc_block(
554 args.minlen = args.maxlen = args.prod = 1; 554 args.minlen = args.maxlen = args.prod = 1;
555 args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL; 555 args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL;
556 if (!args.wasdel && xfs_trans_get_block_res(args.tp) == 0) { 556 if (!args.wasdel && xfs_trans_get_block_res(args.tp) == 0) {
557 error = XFS_ERROR(ENOSPC); 557 error = ENOSPC;
558 goto error0; 558 goto error0;
559 } 559 }
560 error = xfs_alloc_vextent(&args); 560 error = xfs_alloc_vextent(&args);
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 703b3ec1796c..ee48642c2802 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -418,7 +418,7 @@ xfs_bmap_count_tree(
418 xfs_trans_brelse(tp, bp); 418 xfs_trans_brelse(tp, bp);
419 XFS_ERROR_REPORT("xfs_bmap_count_tree(1)", 419 XFS_ERROR_REPORT("xfs_bmap_count_tree(1)",
420 XFS_ERRLEVEL_LOW, mp); 420 XFS_ERRLEVEL_LOW, mp);
421 return XFS_ERROR(EFSCORRUPTED); 421 return EFSCORRUPTED;
422 } 422 }
423 xfs_trans_brelse(tp, bp); 423 xfs_trans_brelse(tp, bp);
424 } else { 424 } else {
@@ -485,7 +485,7 @@ xfs_bmap_count_blocks(
485 if (unlikely(xfs_bmap_count_tree(mp, tp, ifp, bno, level, count) < 0)) { 485 if (unlikely(xfs_bmap_count_tree(mp, tp, ifp, bno, level, count) < 0)) {
486 XFS_ERROR_REPORT("xfs_bmap_count_blocks(2)", XFS_ERRLEVEL_LOW, 486 XFS_ERROR_REPORT("xfs_bmap_count_blocks(2)", XFS_ERRLEVEL_LOW,
487 mp); 487 mp);
488 return XFS_ERROR(EFSCORRUPTED); 488 return EFSCORRUPTED;
489 } 489 }
490 490
491 return 0; 491 return 0;
@@ -577,13 +577,13 @@ xfs_getbmap(
577 if (ip->i_d.di_aformat != XFS_DINODE_FMT_EXTENTS && 577 if (ip->i_d.di_aformat != XFS_DINODE_FMT_EXTENTS &&
578 ip->i_d.di_aformat != XFS_DINODE_FMT_BTREE && 578 ip->i_d.di_aformat != XFS_DINODE_FMT_BTREE &&
579 ip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL) 579 ip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL)
580 return XFS_ERROR(EINVAL); 580 return EINVAL;
581 } else if (unlikely( 581 } else if (unlikely(
582 ip->i_d.di_aformat != 0 && 582 ip->i_d.di_aformat != 0 &&
583 ip->i_d.di_aformat != XFS_DINODE_FMT_EXTENTS)) { 583 ip->i_d.di_aformat != XFS_DINODE_FMT_EXTENTS)) {
584 XFS_ERROR_REPORT("xfs_getbmap", XFS_ERRLEVEL_LOW, 584 XFS_ERROR_REPORT("xfs_getbmap", XFS_ERRLEVEL_LOW,
585 ip->i_mount); 585 ip->i_mount);
586 return XFS_ERROR(EFSCORRUPTED); 586 return EFSCORRUPTED;
587 } 587 }
588 588
589 prealloced = 0; 589 prealloced = 0;
@@ -592,7 +592,7 @@ xfs_getbmap(
592 if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS && 592 if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS &&
593 ip->i_d.di_format != XFS_DINODE_FMT_BTREE && 593 ip->i_d.di_format != XFS_DINODE_FMT_BTREE &&
594 ip->i_d.di_format != XFS_DINODE_FMT_LOCAL) 594 ip->i_d.di_format != XFS_DINODE_FMT_LOCAL)
595 return XFS_ERROR(EINVAL); 595 return EINVAL;
596 596
597 if (xfs_get_extsz_hint(ip) || 597 if (xfs_get_extsz_hint(ip) ||
598 ip->i_d.di_flags & (XFS_DIFLAG_PREALLOC|XFS_DIFLAG_APPEND)){ 598 ip->i_d.di_flags & (XFS_DIFLAG_PREALLOC|XFS_DIFLAG_APPEND)){
@@ -612,20 +612,20 @@ xfs_getbmap(
612 bmv->bmv_entries = 0; 612 bmv->bmv_entries = 0;
613 return 0; 613 return 0;
614 } else if (bmv->bmv_length < 0) { 614 } else if (bmv->bmv_length < 0) {
615 return XFS_ERROR(EINVAL); 615 return EINVAL;
616 } 616 }
617 617
618 nex = bmv->bmv_count - 1; 618 nex = bmv->bmv_count - 1;
619 if (nex <= 0) 619 if (nex <= 0)
620 return XFS_ERROR(EINVAL); 620 return EINVAL;
621 bmvend = bmv->bmv_offset + bmv->bmv_length; 621 bmvend = bmv->bmv_offset + bmv->bmv_length;
622 622
623 623
624 if (bmv->bmv_count > ULONG_MAX / sizeof(struct getbmapx)) 624 if (bmv->bmv_count > ULONG_MAX / sizeof(struct getbmapx))
625 return XFS_ERROR(ENOMEM); 625 return ENOMEM;
626 out = kmem_zalloc_large(bmv->bmv_count * sizeof(struct getbmapx), 0); 626 out = kmem_zalloc_large(bmv->bmv_count * sizeof(struct getbmapx), 0);
627 if (!out) 627 if (!out)
628 return XFS_ERROR(ENOMEM); 628 return ENOMEM;
629 629
630 xfs_ilock(ip, XFS_IOLOCK_SHARED); 630 xfs_ilock(ip, XFS_IOLOCK_SHARED);
631 if (whichfork == XFS_DATA_FORK) { 631 if (whichfork == XFS_DATA_FORK) {
@@ -1008,14 +1008,14 @@ xfs_alloc_file_space(
1008 trace_xfs_alloc_file_space(ip); 1008 trace_xfs_alloc_file_space(ip);
1009 1009
1010 if (XFS_FORCED_SHUTDOWN(mp)) 1010 if (XFS_FORCED_SHUTDOWN(mp))
1011 return XFS_ERROR(EIO); 1011 return EIO;
1012 1012
1013 error = xfs_qm_dqattach(ip, 0); 1013 error = xfs_qm_dqattach(ip, 0);
1014 if (error) 1014 if (error)
1015 return error; 1015 return error;
1016 1016
1017 if (len <= 0) 1017 if (len <= 0)
1018 return XFS_ERROR(EINVAL); 1018 return EINVAL;
1019 1019
1020 rt = XFS_IS_REALTIME_INODE(ip); 1020 rt = XFS_IS_REALTIME_INODE(ip);
1021 extsz = xfs_get_extsz_hint(ip); 1021 extsz = xfs_get_extsz_hint(ip);
@@ -1118,7 +1118,7 @@ xfs_alloc_file_space(
1118 allocated_fsb = imapp->br_blockcount; 1118 allocated_fsb = imapp->br_blockcount;
1119 1119
1120 if (nimaps == 0) { 1120 if (nimaps == 0) {
1121 error = XFS_ERROR(ENOSPC); 1121 error = ENOSPC;
1122 break; 1122 break;
1123 } 1123 }
1124 1124
@@ -1179,7 +1179,7 @@ xfs_zero_remaining_bytes(
1179 mp->m_rtdev_targp : mp->m_ddev_targp, 1179 mp->m_rtdev_targp : mp->m_ddev_targp,
1180 BTOBB(mp->m_sb.sb_blocksize), 0); 1180 BTOBB(mp->m_sb.sb_blocksize), 0);
1181 if (!bp) 1181 if (!bp)
1182 return XFS_ERROR(ENOMEM); 1182 return ENOMEM;
1183 1183
1184 xfs_buf_unlock(bp); 1184 xfs_buf_unlock(bp);
1185 1185
@@ -1211,7 +1211,7 @@ xfs_zero_remaining_bytes(
1211 XFS_BUF_SET_ADDR(bp, xfs_fsb_to_db(ip, imap.br_startblock)); 1211 XFS_BUF_SET_ADDR(bp, xfs_fsb_to_db(ip, imap.br_startblock));
1212 1212
1213 if (XFS_FORCED_SHUTDOWN(mp)) { 1213 if (XFS_FORCED_SHUTDOWN(mp)) {
1214 error = XFS_ERROR(EIO); 1214 error = EIO;
1215 break; 1215 break;
1216 } 1216 }
1217 xfs_buf_iorequest(bp); 1217 xfs_buf_iorequest(bp);
@@ -1229,7 +1229,7 @@ xfs_zero_remaining_bytes(
1229 XFS_BUF_WRITE(bp); 1229 XFS_BUF_WRITE(bp);
1230 1230
1231 if (XFS_FORCED_SHUTDOWN(mp)) { 1231 if (XFS_FORCED_SHUTDOWN(mp)) {
1232 error = XFS_ERROR(EIO); 1232 error = EIO;
1233 break; 1233 break;
1234 } 1234 }
1235 xfs_buf_iorequest(bp); 1235 xfs_buf_iorequest(bp);
@@ -1689,7 +1689,7 @@ xfs_swap_extents(
1689 1689
1690 tempifp = kmem_alloc(sizeof(xfs_ifork_t), KM_MAYFAIL); 1690 tempifp = kmem_alloc(sizeof(xfs_ifork_t), KM_MAYFAIL);
1691 if (!tempifp) { 1691 if (!tempifp) {
1692 error = XFS_ERROR(ENOMEM); 1692 error = ENOMEM;
1693 goto out; 1693 goto out;
1694 } 1694 }
1695 1695
@@ -1704,13 +1704,13 @@ xfs_swap_extents(
1704 1704
1705 /* Verify that both files have the same format */ 1705 /* Verify that both files have the same format */
1706 if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) { 1706 if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) {
1707 error = XFS_ERROR(EINVAL); 1707 error = EINVAL;
1708 goto out_unlock; 1708 goto out_unlock;
1709 } 1709 }
1710 1710
1711 /* Verify both files are either real-time or non-realtime */ 1711 /* Verify both files are either real-time or non-realtime */
1712 if (XFS_IS_REALTIME_INODE(ip) != XFS_IS_REALTIME_INODE(tip)) { 1712 if (XFS_IS_REALTIME_INODE(ip) != XFS_IS_REALTIME_INODE(tip)) {
1713 error = XFS_ERROR(EINVAL); 1713 error = EINVAL;
1714 goto out_unlock; 1714 goto out_unlock;
1715 } 1715 }
1716 1716
@@ -1721,7 +1721,7 @@ xfs_swap_extents(
1721 1721
1722 /* Verify O_DIRECT for ftmp */ 1722 /* Verify O_DIRECT for ftmp */
1723 if (VN_CACHED(VFS_I(tip)) != 0) { 1723 if (VN_CACHED(VFS_I(tip)) != 0) {
1724 error = XFS_ERROR(EINVAL); 1724 error = EINVAL;
1725 goto out_unlock; 1725 goto out_unlock;
1726 } 1726 }
1727 1727
@@ -1729,7 +1729,7 @@ xfs_swap_extents(
1729 if (sxp->sx_offset != 0 || 1729 if (sxp->sx_offset != 0 ||
1730 sxp->sx_length != ip->i_d.di_size || 1730 sxp->sx_length != ip->i_d.di_size ||
1731 sxp->sx_length != tip->i_d.di_size) { 1731 sxp->sx_length != tip->i_d.di_size) {
1732 error = XFS_ERROR(EFAULT); 1732 error = EFAULT;
1733 goto out_unlock; 1733 goto out_unlock;
1734 } 1734 }
1735 1735
@@ -1756,7 +1756,7 @@ xfs_swap_extents(
1756 (sbp->bs_ctime.tv_nsec != VFS_I(ip)->i_ctime.tv_nsec) || 1756 (sbp->bs_ctime.tv_nsec != VFS_I(ip)->i_ctime.tv_nsec) ||
1757 (sbp->bs_mtime.tv_sec != VFS_I(ip)->i_mtime.tv_sec) || 1757 (sbp->bs_mtime.tv_sec != VFS_I(ip)->i_mtime.tv_sec) ||
1758 (sbp->bs_mtime.tv_nsec != VFS_I(ip)->i_mtime.tv_nsec)) { 1758 (sbp->bs_mtime.tv_nsec != VFS_I(ip)->i_mtime.tv_nsec)) {
1759 error = XFS_ERROR(EBUSY); 1759 error = EBUSY;
1760 goto out_unlock; 1760 goto out_unlock;
1761 } 1761 }
1762 1762
@@ -1767,7 +1767,7 @@ xfs_swap_extents(
1767 * until we have switched the extents. 1767 * until we have switched the extents.
1768 */ 1768 */
1769 if (VN_MAPPED(VFS_I(ip))) { 1769 if (VN_MAPPED(VFS_I(ip))) {
1770 error = XFS_ERROR(EBUSY); 1770 error = EBUSY;
1771 goto out_unlock; 1771 goto out_unlock;
1772 } 1772 }
1773 1773
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index bf810c6baf2b..036b4fd34bf7 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -91,7 +91,7 @@ xfs_btree_check_lblock(
91 if (bp) 91 if (bp)
92 trace_xfs_btree_corrupt(bp, _RET_IP_); 92 trace_xfs_btree_corrupt(bp, _RET_IP_);
93 XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); 93 XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
94 return XFS_ERROR(EFSCORRUPTED); 94 return EFSCORRUPTED;
95 } 95 }
96 return 0; 96 return 0;
97} 97}
@@ -139,7 +139,7 @@ xfs_btree_check_sblock(
139 if (bp) 139 if (bp)
140 trace_xfs_btree_corrupt(bp, _RET_IP_); 140 trace_xfs_btree_corrupt(bp, _RET_IP_);
141 XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); 141 XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
142 return XFS_ERROR(EFSCORRUPTED); 142 return EFSCORRUPTED;
143 } 143 }
144 return 0; 144 return 0;
145} 145}
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 7f2711f309a1..a1a4e3e47a1e 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -1579,7 +1579,7 @@ xfs_da3_node_lookup_int(
1579 args->blkno = blk->blkno; 1579 args->blkno = blk->blkno;
1580 } else { 1580 } else {
1581 ASSERT(0); 1581 ASSERT(0);
1582 return XFS_ERROR(EFSCORRUPTED); 1582 return EFSCORRUPTED;
1583 } 1583 }
1584 if (((retval == ENOENT) || (retval == ENOATTR)) && 1584 if (((retval == ENOENT) || (retval == ENOATTR)) &&
1585 (blk->hashval == args->hashval)) { 1585 (blk->hashval == args->hashval)) {
@@ -1591,7 +1591,7 @@ xfs_da3_node_lookup_int(
1591 continue; 1591 continue;
1592 } else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { 1592 } else if (blk->magic == XFS_ATTR_LEAF_MAGIC) {
1593 /* path_shift() gives ENOENT */ 1593 /* path_shift() gives ENOENT */
1594 retval = XFS_ERROR(ENOATTR); 1594 retval = ENOATTR;
1595 } 1595 }
1596 } 1596 }
1597 break; 1597 break;
@@ -1859,7 +1859,7 @@ xfs_da3_path_shift(
1859 } 1859 }
1860 } 1860 }
1861 if (level < 0) { 1861 if (level < 0) {
1862 *result = XFS_ERROR(ENOENT); /* we're out of our tree */ 1862 *result = ENOENT; /* we're out of our tree */
1863 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); 1863 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
1864 return 0; 1864 return 0;
1865 } 1865 }
@@ -2068,7 +2068,7 @@ xfs_da_grow_inode_int(
2068 if (got != count || mapp[0].br_startoff != *bno || 2068 if (got != count || mapp[0].br_startoff != *bno ||
2069 mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount != 2069 mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount !=
2070 *bno + count) { 2070 *bno + count) {
2071 error = XFS_ERROR(ENOSPC); 2071 error = ENOSPC;
2072 goto out_free_map; 2072 goto out_free_map;
2073 } 2073 }
2074 2074
@@ -2158,7 +2158,7 @@ xfs_da3_swap_lastblock(
2158 if (unlikely(lastoff == 0)) { 2158 if (unlikely(lastoff == 0)) {
2159 XFS_ERROR_REPORT("xfs_da_swap_lastblock(1)", XFS_ERRLEVEL_LOW, 2159 XFS_ERROR_REPORT("xfs_da_swap_lastblock(1)", XFS_ERRLEVEL_LOW,
2160 mp); 2160 mp);
2161 return XFS_ERROR(EFSCORRUPTED); 2161 return EFSCORRUPTED;
2162 } 2162 }
2163 /* 2163 /*
2164 * Read the last block in the btree space. 2164 * Read the last block in the btree space.
@@ -2209,7 +2209,7 @@ xfs_da3_swap_lastblock(
2209 sib_info->magic != dead_info->magic)) { 2209 sib_info->magic != dead_info->magic)) {
2210 XFS_ERROR_REPORT("xfs_da_swap_lastblock(2)", 2210 XFS_ERROR_REPORT("xfs_da_swap_lastblock(2)",
2211 XFS_ERRLEVEL_LOW, mp); 2211 XFS_ERRLEVEL_LOW, mp);
2212 error = XFS_ERROR(EFSCORRUPTED); 2212 error = EFSCORRUPTED;
2213 goto done; 2213 goto done;
2214 } 2214 }
2215 sib_info->forw = cpu_to_be32(dead_blkno); 2215 sib_info->forw = cpu_to_be32(dead_blkno);
@@ -2231,7 +2231,7 @@ xfs_da3_swap_lastblock(
2231 sib_info->magic != dead_info->magic)) { 2231 sib_info->magic != dead_info->magic)) {
2232 XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)", 2232 XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)",
2233 XFS_ERRLEVEL_LOW, mp); 2233 XFS_ERRLEVEL_LOW, mp);
2234 error = XFS_ERROR(EFSCORRUPTED); 2234 error = EFSCORRUPTED;
2235 goto done; 2235 goto done;
2236 } 2236 }
2237 sib_info->back = cpu_to_be32(dead_blkno); 2237 sib_info->back = cpu_to_be32(dead_blkno);
@@ -2254,7 +2254,7 @@ xfs_da3_swap_lastblock(
2254 if (level >= 0 && level != par_hdr.level + 1) { 2254 if (level >= 0 && level != par_hdr.level + 1) {
2255 XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)", 2255 XFS_ERROR_REPORT("xfs_da_swap_lastblock(4)",
2256 XFS_ERRLEVEL_LOW, mp); 2256 XFS_ERRLEVEL_LOW, mp);
2257 error = XFS_ERROR(EFSCORRUPTED); 2257 error = EFSCORRUPTED;
2258 goto done; 2258 goto done;
2259 } 2259 }
2260 level = par_hdr.level; 2260 level = par_hdr.level;
@@ -2267,7 +2267,7 @@ xfs_da3_swap_lastblock(
2267 if (entno == par_hdr.count) { 2267 if (entno == par_hdr.count) {
2268 XFS_ERROR_REPORT("xfs_da_swap_lastblock(5)", 2268 XFS_ERROR_REPORT("xfs_da_swap_lastblock(5)",
2269 XFS_ERRLEVEL_LOW, mp); 2269 XFS_ERRLEVEL_LOW, mp);
2270 error = XFS_ERROR(EFSCORRUPTED); 2270 error = EFSCORRUPTED;
2271 goto done; 2271 goto done;
2272 } 2272 }
2273 par_blkno = be32_to_cpu(btree[entno].before); 2273 par_blkno = be32_to_cpu(btree[entno].before);
@@ -2294,7 +2294,7 @@ xfs_da3_swap_lastblock(
2294 if (unlikely(par_blkno == 0)) { 2294 if (unlikely(par_blkno == 0)) {
2295 XFS_ERROR_REPORT("xfs_da_swap_lastblock(6)", 2295 XFS_ERROR_REPORT("xfs_da_swap_lastblock(6)",
2296 XFS_ERRLEVEL_LOW, mp); 2296 XFS_ERRLEVEL_LOW, mp);
2297 error = XFS_ERROR(EFSCORRUPTED); 2297 error = EFSCORRUPTED;
2298 goto done; 2298 goto done;
2299 } 2299 }
2300 error = xfs_da3_node_read(tp, dp, par_blkno, -1, &par_buf, w); 2300 error = xfs_da3_node_read(tp, dp, par_blkno, -1, &par_buf, w);
@@ -2305,7 +2305,7 @@ xfs_da3_swap_lastblock(
2305 if (par_hdr.level != level) { 2305 if (par_hdr.level != level) {
2306 XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)", 2306 XFS_ERROR_REPORT("xfs_da_swap_lastblock(7)",
2307 XFS_ERRLEVEL_LOW, mp); 2307 XFS_ERRLEVEL_LOW, mp);
2308 error = XFS_ERROR(EFSCORRUPTED); 2308 error = EFSCORRUPTED;
2309 goto done; 2309 goto done;
2310 } 2310 }
2311 btree = dp->d_ops->node_tree_p(par_node); 2311 btree = dp->d_ops->node_tree_p(par_node);
@@ -2500,7 +2500,7 @@ xfs_dabuf_map(
2500 } 2500 }
2501 2501
2502 if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) { 2502 if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) {
2503 error = mappedbno == -2 ? -1 : XFS_ERROR(EFSCORRUPTED); 2503 error = mappedbno == -2 ? -1 : EFSCORRUPTED;
2504 if (unlikely(error == EFSCORRUPTED)) { 2504 if (unlikely(error == EFSCORRUPTED)) {
2505 if (xfs_error_level >= XFS_ERRLEVEL_LOW) { 2505 if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
2506 int i; 2506 int i;
@@ -2561,7 +2561,7 @@ xfs_da_get_buf(
2561 2561
2562 bp = xfs_trans_get_buf_map(trans, dp->i_mount->m_ddev_targp, 2562 bp = xfs_trans_get_buf_map(trans, dp->i_mount->m_ddev_targp,
2563 mapp, nmap, 0); 2563 mapp, nmap, 0);
2564 error = bp ? bp->b_error : XFS_ERROR(EIO); 2564 error = bp ? bp->b_error : EIO;
2565 if (error) { 2565 if (error) {
2566 xfs_trans_brelse(trans, bp); 2566 xfs_trans_brelse(trans, bp);
2567 goto out_free; 2567 goto out_free;
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index 79670cda48ae..a0aca734199b 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -202,7 +202,7 @@ xfs_dir_ino_validate(
202 xfs_warn(mp, "Invalid inode number 0x%Lx", 202 xfs_warn(mp, "Invalid inode number 0x%Lx",
203 (unsigned long long) ino); 203 (unsigned long long) ino);
204 XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp); 204 XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp);
205 return XFS_ERROR(EFSCORRUPTED); 205 return EFSCORRUPTED;
206 } 206 }
207 return 0; 207 return 0;
208} 208}
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index c7cd3154026a..ab0bffccf5c3 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -392,7 +392,7 @@ xfs_dir2_block_addname(
392 if (args->op_flags & XFS_DA_OP_JUSTCHECK) { 392 if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
393 xfs_trans_brelse(tp, bp); 393 xfs_trans_brelse(tp, bp);
394 if (!dup) 394 if (!dup)
395 return XFS_ERROR(ENOSPC); 395 return ENOSPC;
396 return 0; 396 return 0;
397 } 397 }
398 398
@@ -402,7 +402,7 @@ xfs_dir2_block_addname(
402 if (!dup) { 402 if (!dup) {
403 /* Don't have a space reservation: return no-space. */ 403 /* Don't have a space reservation: return no-space. */
404 if (args->total == 0) 404 if (args->total == 0)
405 return XFS_ERROR(ENOSPC); 405 return ENOSPC;
406 /* 406 /*
407 * Convert to the next larger format. 407 * Convert to the next larger format.
408 * Then add the new entry in that format. 408 * Then add the new entry in that format.
@@ -647,7 +647,7 @@ xfs_dir2_block_lookup(
647 args->filetype = dp->d_ops->data_get_ftype(dep); 647 args->filetype = dp->d_ops->data_get_ftype(dep);
648 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen); 648 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
649 xfs_trans_brelse(args->trans, bp); 649 xfs_trans_brelse(args->trans, bp);
650 return XFS_ERROR(error); 650 return error;
651} 651}
652 652
653/* 653/*
@@ -703,7 +703,7 @@ xfs_dir2_block_lookup_int(
703 if (low > high) { 703 if (low > high) {
704 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); 704 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
705 xfs_trans_brelse(tp, bp); 705 xfs_trans_brelse(tp, bp);
706 return XFS_ERROR(ENOENT); 706 return ENOENT;
707 } 707 }
708 } 708 }
709 /* 709 /*
@@ -751,7 +751,7 @@ xfs_dir2_block_lookup_int(
751 * No match, release the buffer and return ENOENT. 751 * No match, release the buffer and return ENOENT.
752 */ 752 */
753 xfs_trans_brelse(tp, bp); 753 xfs_trans_brelse(tp, bp);
754 return XFS_ERROR(ENOENT); 754 return ENOENT;
755} 755}
756 756
757/* 757/*
@@ -1091,7 +1091,7 @@ xfs_dir2_sf_to_block(
1091 */ 1091 */
1092 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { 1092 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) {
1093 ASSERT(XFS_FORCED_SHUTDOWN(mp)); 1093 ASSERT(XFS_FORCED_SHUTDOWN(mp));
1094 return XFS_ERROR(EIO); 1094 return EIO;
1095 } 1095 }
1096 1096
1097 oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data; 1097 oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data;
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index fb0aad4440c1..78b411bfc543 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -731,7 +731,7 @@ xfs_dir2_leaf_addname(
731 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || 731 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) ||
732 args->total == 0) { 732 args->total == 0) {
733 xfs_trans_brelse(tp, lbp); 733 xfs_trans_brelse(tp, lbp);
734 return XFS_ERROR(ENOSPC); 734 return ENOSPC;
735 } 735 }
736 /* 736 /*
737 * Convert to node form. 737 * Convert to node form.
@@ -755,7 +755,7 @@ xfs_dir2_leaf_addname(
755 */ 755 */
756 if (args->op_flags & XFS_DA_OP_JUSTCHECK) { 756 if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
757 xfs_trans_brelse(tp, lbp); 757 xfs_trans_brelse(tp, lbp);
758 return use_block == -1 ? XFS_ERROR(ENOSPC) : 0; 758 return use_block == -1 ? ENOSPC : 0;
759 } 759 }
760 /* 760 /*
761 * If no allocations are allowed, return now before we've 761 * If no allocations are allowed, return now before we've
@@ -763,7 +763,7 @@ xfs_dir2_leaf_addname(
763 */ 763 */
764 if (args->total == 0 && use_block == -1) { 764 if (args->total == 0 && use_block == -1) {
765 xfs_trans_brelse(tp, lbp); 765 xfs_trans_brelse(tp, lbp);
766 return XFS_ERROR(ENOSPC); 766 return ENOSPC;
767 } 767 }
768 /* 768 /*
769 * Need to compact the leaf entries, removing stale ones. 769 * Need to compact the leaf entries, removing stale ones.
@@ -1198,7 +1198,7 @@ xfs_dir2_leaf_lookup(
1198 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen); 1198 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
1199 xfs_trans_brelse(tp, dbp); 1199 xfs_trans_brelse(tp, dbp);
1200 xfs_trans_brelse(tp, lbp); 1200 xfs_trans_brelse(tp, lbp);
1201 return XFS_ERROR(error); 1201 return error;
1202} 1202}
1203 1203
1204/* 1204/*
@@ -1333,7 +1333,7 @@ xfs_dir2_leaf_lookup_int(
1333 if (dbp) 1333 if (dbp)
1334 xfs_trans_brelse(tp, dbp); 1334 xfs_trans_brelse(tp, dbp);
1335 xfs_trans_brelse(tp, lbp); 1335 xfs_trans_brelse(tp, lbp);
1336 return XFS_ERROR(ENOENT); 1336 return ENOENT;
1337} 1337}
1338 1338
1339/* 1339/*
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index da43d304fca2..4cf8b99d09a4 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -406,7 +406,7 @@ xfs_dir2_leafn_add(
406 * into other peoples memory 406 * into other peoples memory
407 */ 407 */
408 if (index < 0) 408 if (index < 0)
409 return XFS_ERROR(EFSCORRUPTED); 409 return EFSCORRUPTED;
410 410
411 /* 411 /*
412 * If there are already the maximum number of leaf entries in 412 * If there are already the maximum number of leaf entries in
@@ -417,7 +417,7 @@ xfs_dir2_leafn_add(
417 417
418 if (leafhdr.count == dp->d_ops->leaf_max_ents(args->geo)) { 418 if (leafhdr.count == dp->d_ops->leaf_max_ents(args->geo)) {
419 if (!leafhdr.stale) 419 if (!leafhdr.stale)
420 return XFS_ERROR(ENOSPC); 420 return ENOSPC;
421 compact = leafhdr.stale > 1; 421 compact = leafhdr.stale > 1;
422 } else 422 } else
423 compact = 0; 423 compact = 0;
@@ -629,7 +629,7 @@ xfs_dir2_leafn_lookup_for_addname(
629 XFS_ERRLEVEL_LOW, mp); 629 XFS_ERRLEVEL_LOW, mp);
630 if (curfdb != newfdb) 630 if (curfdb != newfdb)
631 xfs_trans_brelse(tp, curbp); 631 xfs_trans_brelse(tp, curbp);
632 return XFS_ERROR(EFSCORRUPTED); 632 return EFSCORRUPTED;
633 } 633 }
634 curfdb = newfdb; 634 curfdb = newfdb;
635 if (be16_to_cpu(bests[fi]) >= length) 635 if (be16_to_cpu(bests[fi]) >= length)
@@ -660,7 +660,7 @@ out:
660 * Return the index, that will be the insertion point. 660 * Return the index, that will be the insertion point.
661 */ 661 */
662 *indexp = index; 662 *indexp = index;
663 return XFS_ERROR(ENOENT); 663 return ENOENT;
664} 664}
665 665
666/* 666/*
@@ -789,7 +789,7 @@ xfs_dir2_leafn_lookup_for_entry(
789 curbp->b_ops = &xfs_dir3_data_buf_ops; 789 curbp->b_ops = &xfs_dir3_data_buf_ops;
790 xfs_trans_buf_set_type(tp, curbp, XFS_BLFT_DIR_DATA_BUF); 790 xfs_trans_buf_set_type(tp, curbp, XFS_BLFT_DIR_DATA_BUF);
791 if (cmp == XFS_CMP_EXACT) 791 if (cmp == XFS_CMP_EXACT)
792 return XFS_ERROR(EEXIST); 792 return EEXIST;
793 } 793 }
794 } 794 }
795 ASSERT(index == leafhdr.count || (args->op_flags & XFS_DA_OP_OKNOENT)); 795 ASSERT(index == leafhdr.count || (args->op_flags & XFS_DA_OP_OKNOENT));
@@ -812,7 +812,7 @@ xfs_dir2_leafn_lookup_for_entry(
812 state->extravalid = 0; 812 state->extravalid = 0;
813 } 813 }
814 *indexp = index; 814 *indexp = index;
815 return XFS_ERROR(ENOENT); 815 return ENOENT;
816} 816}
817 817
818/* 818/*
@@ -1815,7 +1815,7 @@ xfs_dir2_node_addname_int(
1815 * Not allowed to allocate, return failure. 1815 * Not allowed to allocate, return failure.
1816 */ 1816 */
1817 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0) 1817 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0)
1818 return XFS_ERROR(ENOSPC); 1818 return ENOSPC;
1819 1819
1820 /* 1820 /*
1821 * Allocate and initialize the new data block. 1821 * Allocate and initialize the new data block.
@@ -1876,7 +1876,7 @@ xfs_dir2_node_addname_int(
1876 } 1876 }
1877 XFS_ERROR_REPORT("xfs_dir2_node_addname_int", 1877 XFS_ERROR_REPORT("xfs_dir2_node_addname_int",
1878 XFS_ERRLEVEL_LOW, mp); 1878 XFS_ERRLEVEL_LOW, mp);
1879 return XFS_ERROR(EFSCORRUPTED); 1879 return EFSCORRUPTED;
1880 } 1880 }
1881 1881
1882 /* 1882 /*
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index 48e99afb9cb0..02390739abf7 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.c
@@ -95,7 +95,7 @@ xfs_dir2_sf_getdents(
95 */ 95 */
96 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { 96 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) {
97 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); 97 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount));
98 return XFS_ERROR(EIO); 98 return EIO;
99 } 99 }
100 100
101 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size); 101 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
@@ -677,7 +677,7 @@ xfs_readdir(
677 trace_xfs_readdir(dp); 677 trace_xfs_readdir(dp);
678 678
679 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 679 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
680 return XFS_ERROR(EIO); 680 return EIO;
681 681
682 ASSERT(S_ISDIR(dp->i_d.di_mode)); 682 ASSERT(S_ISDIR(dp->i_d.di_mode));
683 XFS_STATS_INC(xs_dir_getdents); 683 XFS_STATS_INC(xs_dir_getdents);
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index 53c3be619db5..ab3563b87995 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -307,7 +307,7 @@ xfs_dir2_sf_addname(
307 */ 307 */
308 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { 308 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) {
309 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); 309 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount));
310 return XFS_ERROR(EIO); 310 return EIO;
311 } 311 }
312 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size); 312 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
313 ASSERT(dp->i_df.if_u1.if_data != NULL); 313 ASSERT(dp->i_df.if_u1.if_data != NULL);
@@ -345,7 +345,7 @@ xfs_dir2_sf_addname(
345 * Just checking or no space reservation, it doesn't fit. 345 * Just checking or no space reservation, it doesn't fit.
346 */ 346 */
347 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0) 347 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0)
348 return XFS_ERROR(ENOSPC); 348 return ENOSPC;
349 /* 349 /*
350 * Convert to block form then add the name. 350 * Convert to block form then add the name.
351 */ 351 */
@@ -738,7 +738,7 @@ xfs_dir2_sf_lookup(
738 */ 738 */
739 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { 739 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) {
740 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); 740 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount));
741 return XFS_ERROR(EIO); 741 return EIO;
742 } 742 }
743 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size); 743 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
744 ASSERT(dp->i_df.if_u1.if_data != NULL); 744 ASSERT(dp->i_df.if_u1.if_data != NULL);
@@ -751,7 +751,7 @@ xfs_dir2_sf_lookup(
751 args->inumber = dp->i_ino; 751 args->inumber = dp->i_ino;
752 args->cmpresult = XFS_CMP_EXACT; 752 args->cmpresult = XFS_CMP_EXACT;
753 args->filetype = XFS_DIR3_FT_DIR; 753 args->filetype = XFS_DIR3_FT_DIR;
754 return XFS_ERROR(EEXIST); 754 return EEXIST;
755 } 755 }
756 /* 756 /*
757 * Special case for .. 757 * Special case for ..
@@ -761,7 +761,7 @@ xfs_dir2_sf_lookup(
761 args->inumber = dp->d_ops->sf_get_parent_ino(sfp); 761 args->inumber = dp->d_ops->sf_get_parent_ino(sfp);
762 args->cmpresult = XFS_CMP_EXACT; 762 args->cmpresult = XFS_CMP_EXACT;
763 args->filetype = XFS_DIR3_FT_DIR; 763 args->filetype = XFS_DIR3_FT_DIR;
764 return XFS_ERROR(EEXIST); 764 return EEXIST;
765 } 765 }
766 /* 766 /*
767 * Loop over all the entries trying to match ours. 767 * Loop over all the entries trying to match ours.
@@ -781,7 +781,7 @@ xfs_dir2_sf_lookup(
781 args->inumber = dp->d_ops->sf_get_ino(sfp, sfep); 781 args->inumber = dp->d_ops->sf_get_ino(sfp, sfep);
782 args->filetype = dp->d_ops->sf_get_ftype(sfep); 782 args->filetype = dp->d_ops->sf_get_ftype(sfep);
783 if (cmp == XFS_CMP_EXACT) 783 if (cmp == XFS_CMP_EXACT)
784 return XFS_ERROR(EEXIST); 784 return EEXIST;
785 ci_sfep = sfep; 785 ci_sfep = sfep;
786 } 786 }
787 } 787 }
@@ -791,10 +791,10 @@ xfs_dir2_sf_lookup(
791 * If a case-insensitive match was not found, return ENOENT. 791 * If a case-insensitive match was not found, return ENOENT.
792 */ 792 */
793 if (!ci_sfep) 793 if (!ci_sfep)
794 return XFS_ERROR(ENOENT); 794 return ENOENT;
795 /* otherwise process the CI match as required by the caller */ 795 /* otherwise process the CI match as required by the caller */
796 error = xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen); 796 error = xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen);
797 return XFS_ERROR(error); 797 return error;
798} 798}
799 799
800/* 800/*
@@ -824,7 +824,7 @@ xfs_dir2_sf_removename(
824 */ 824 */
825 if (oldsize < offsetof(xfs_dir2_sf_hdr_t, parent)) { 825 if (oldsize < offsetof(xfs_dir2_sf_hdr_t, parent)) {
826 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); 826 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount));
827 return XFS_ERROR(EIO); 827 return EIO;
828 } 828 }
829 ASSERT(dp->i_df.if_bytes == oldsize); 829 ASSERT(dp->i_df.if_bytes == oldsize);
830 ASSERT(dp->i_df.if_u1.if_data != NULL); 830 ASSERT(dp->i_df.if_u1.if_data != NULL);
@@ -847,7 +847,7 @@ xfs_dir2_sf_removename(
847 * Didn't find it. 847 * Didn't find it.
848 */ 848 */
849 if (i == sfp->count) 849 if (i == sfp->count)
850 return XFS_ERROR(ENOENT); 850 return ENOENT;
851 /* 851 /*
852 * Calculate sizes. 852 * Calculate sizes.
853 */ 853 */
@@ -914,7 +914,7 @@ xfs_dir2_sf_replace(
914 */ 914 */
915 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) { 915 if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t, parent)) {
916 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount)); 916 ASSERT(XFS_FORCED_SHUTDOWN(dp->i_mount));
917 return XFS_ERROR(EIO); 917 return EIO;
918 } 918 }
919 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size); 919 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
920 ASSERT(dp->i_df.if_u1.if_data != NULL); 920 ASSERT(dp->i_df.if_u1.if_data != NULL);
@@ -990,7 +990,7 @@ xfs_dir2_sf_replace(
990 if (i8elevated) 990 if (i8elevated)
991 xfs_dir2_sf_toino4(args); 991 xfs_dir2_sf_toino4(args);
992#endif 992#endif
993 return XFS_ERROR(ENOENT); 993 return ENOENT;
994 } 994 }
995 } 995 }
996#if XFS_BIG_INUMS 996#if XFS_BIG_INUMS
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
index 4f11ef011139..3fee16e63f3a 100644
--- a/fs/xfs/xfs_discard.c
+++ b/fs/xfs/xfs_discard.c
@@ -166,11 +166,11 @@ xfs_ioc_trim(
166 int error, last_error = 0; 166 int error, last_error = 0;
167 167
168 if (!capable(CAP_SYS_ADMIN)) 168 if (!capable(CAP_SYS_ADMIN))
169 return -XFS_ERROR(EPERM); 169 return -EPERM;
170 if (!blk_queue_discard(q)) 170 if (!blk_queue_discard(q))
171 return -XFS_ERROR(EOPNOTSUPP); 171 return -EOPNOTSUPP;
172 if (copy_from_user(&range, urange, sizeof(range))) 172 if (copy_from_user(&range, urange, sizeof(range)))
173 return -XFS_ERROR(EFAULT); 173 return -EFAULT;
174 174
175 /* 175 /*
176 * Truncating down the len isn't actually quite correct, but using 176 * Truncating down the len isn't actually quite correct, but using
@@ -182,7 +182,7 @@ xfs_ioc_trim(
182 if (range.start >= XFS_FSB_TO_B(mp, mp->m_sb.sb_dblocks) || 182 if (range.start >= XFS_FSB_TO_B(mp, mp->m_sb.sb_dblocks) ||
183 range.minlen > XFS_FSB_TO_B(mp, XFS_ALLOC_AG_MAX_USABLE(mp)) || 183 range.minlen > XFS_FSB_TO_B(mp, XFS_ALLOC_AG_MAX_USABLE(mp)) ||
184 range.len < mp->m_sb.sb_blocksize) 184 range.len < mp->m_sb.sb_blocksize)
185 return -XFS_ERROR(EINVAL); 185 return -EINVAL;
186 186
187 start = BTOBB(range.start); 187 start = BTOBB(range.start);
188 end = start + BTOBBT(range.len) - 1; 188 end = start + BTOBBT(range.len) - 1;
@@ -206,7 +206,7 @@ xfs_ioc_trim(
206 206
207 range.len = XFS_FSB_TO_B(mp, blocks_trimmed); 207 range.len = XFS_FSB_TO_B(mp, blocks_trimmed);
208 if (copy_to_user(urange, &range, sizeof(range))) 208 if (copy_to_user(urange, &range, sizeof(range)))
209 return -XFS_ERROR(EFAULT); 209 return -EFAULT;
210 return 0; 210 return 0;
211} 211}
212 212
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 9dc5d3954cf7..3ee242686181 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -426,7 +426,7 @@ xfs_qm_dqrepair(
426 426
427 if (error) { 427 if (error) {
428 ASSERT(*bpp == NULL); 428 ASSERT(*bpp == NULL);
429 return XFS_ERROR(error); 429 return error;
430 } 430 }
431 (*bpp)->b_ops = &xfs_dquot_buf_ops; 431 (*bpp)->b_ops = &xfs_dquot_buf_ops;
432 432
@@ -442,7 +442,7 @@ xfs_qm_dqrepair(
442 if (error) { 442 if (error) {
443 /* repair failed, we're screwed */ 443 /* repair failed, we're screwed */
444 xfs_trans_brelse(tp, *bpp); 444 xfs_trans_brelse(tp, *bpp);
445 return XFS_ERROR(EIO); 445 return EIO;
446 } 446 }
447 } 447 }
448 448
@@ -539,7 +539,7 @@ xfs_qm_dqtobp(
539 539
540 if (error) { 540 if (error) {
541 ASSERT(bp == NULL); 541 ASSERT(bp == NULL);
542 return XFS_ERROR(error); 542 return error;
543 } 543 }
544 } 544 }
545 545
@@ -796,7 +796,7 @@ restart:
796 } else { 796 } else {
797 /* inode stays locked on return */ 797 /* inode stays locked on return */
798 xfs_qm_dqdestroy(dqp); 798 xfs_qm_dqdestroy(dqp);
799 return XFS_ERROR(ESRCH); 799 return ESRCH;
800 } 800 }
801 } 801 }
802 802
@@ -966,7 +966,7 @@ xfs_qm_dqflush(
966 SHUTDOWN_CORRUPT_INCORE); 966 SHUTDOWN_CORRUPT_INCORE);
967 else 967 else
968 spin_unlock(&mp->m_ail->xa_lock); 968 spin_unlock(&mp->m_ail->xa_lock);
969 error = XFS_ERROR(EIO); 969 error = EIO;
970 goto out_unlock; 970 goto out_unlock;
971 } 971 }
972 972
@@ -992,7 +992,7 @@ xfs_qm_dqflush(
992 xfs_buf_relse(bp); 992 xfs_buf_relse(bp);
993 xfs_dqfunlock(dqp); 993 xfs_dqfunlock(dqp);
994 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 994 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
995 return XFS_ERROR(EIO); 995 return EIO;
996 } 996 }
997 997
998 /* This is the only portion of data that needs to persist */ 998 /* This is the only portion of data that needs to persist */
@@ -1045,7 +1045,7 @@ xfs_qm_dqflush(
1045 1045
1046out_unlock: 1046out_unlock:
1047 xfs_dqfunlock(dqp); 1047 xfs_dqfunlock(dqp);
1048 return XFS_ERROR(EIO); 1048 return EIO;
1049} 1049}
1050 1050
1051/* 1051/*
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index edac5b057d28..14f98c2f0daf 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -27,29 +27,6 @@
27 27
28#ifdef DEBUG 28#ifdef DEBUG
29 29
30int xfs_etrap[XFS_ERROR_NTRAP] = {
31 0,
32};
33
34int
35xfs_error_trap(int e)
36{
37 int i;
38
39 if (!e)
40 return 0;
41 for (i = 0; i < XFS_ERROR_NTRAP; i++) {
42 if (xfs_etrap[i] == 0)
43 break;
44 if (e != xfs_etrap[i])
45 continue;
46 xfs_notice(NULL, "%s: error %d", __func__, e);
47 BUG();
48 break;
49 }
50 return e;
51}
52
53int xfs_etest[XFS_NUM_INJECT_ERROR]; 30int xfs_etest[XFS_NUM_INJECT_ERROR];
54int64_t xfs_etest_fsid[XFS_NUM_INJECT_ERROR]; 31int64_t xfs_etest_fsid[XFS_NUM_INJECT_ERROR];
55char * xfs_etest_fsname[XFS_NUM_INJECT_ERROR]; 32char * xfs_etest_fsname[XFS_NUM_INJECT_ERROR];
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index c1c57d4a4b5d..a2b5b4cfd228 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -18,15 +18,6 @@
18#ifndef __XFS_ERROR_H__ 18#ifndef __XFS_ERROR_H__
19#define __XFS_ERROR_H__ 19#define __XFS_ERROR_H__
20 20
21#ifdef DEBUG
22#define XFS_ERROR_NTRAP 10
23extern int xfs_etrap[XFS_ERROR_NTRAP];
24extern int xfs_error_trap(int);
25#define XFS_ERROR(e) xfs_error_trap(e)
26#else
27#define XFS_ERROR(e) (e)
28#endif
29
30struct xfs_mount; 21struct xfs_mount;
31 22
32extern void xfs_error_report(const char *tag, int level, struct xfs_mount *mp, 23extern void xfs_error_report(const char *tag, int level, struct xfs_mount *mp,
@@ -56,7 +47,7 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
56 if (unlikely(!fs_is_ok)) { \ 47 if (unlikely(!fs_is_ok)) { \
57 XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_GOTO", \ 48 XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_GOTO", \
58 XFS_ERRLEVEL_LOW, NULL); \ 49 XFS_ERRLEVEL_LOW, NULL); \
59 error = XFS_ERROR(EFSCORRUPTED); \ 50 error = EFSCORRUPTED; \
60 goto l; \ 51 goto l; \
61 } \ 52 } \
62 } 53 }
@@ -68,7 +59,7 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
68 if (unlikely(!fs_is_ok)) { \ 59 if (unlikely(!fs_is_ok)) { \
69 XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \ 60 XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \
70 XFS_ERRLEVEL_LOW, NULL); \ 61 XFS_ERRLEVEL_LOW, NULL); \
71 return XFS_ERROR(EFSCORRUPTED); \ 62 return EFSCORRUPTED; \
72 } \ 63 } \
73 } 64 }
74 65
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 1f66779d7a46..754caa0e8ef2 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -179,7 +179,7 @@ xfs_file_fsync(
179 return error; 179 return error;
180 180
181 if (XFS_FORCED_SHUTDOWN(mp)) 181 if (XFS_FORCED_SHUTDOWN(mp))
182 return -XFS_ERROR(EIO); 182 return -EIO;
183 183
184 xfs_iflags_clear(ip, XFS_ITRUNCATED); 184 xfs_iflags_clear(ip, XFS_ITRUNCATED);
185 185
@@ -258,7 +258,7 @@ xfs_file_read_iter(
258 if ((pos | size) & target->bt_logical_sectormask) { 258 if ((pos | size) & target->bt_logical_sectormask) {
259 if (pos == i_size_read(inode)) 259 if (pos == i_size_read(inode))
260 return 0; 260 return 0;
261 return -XFS_ERROR(EINVAL); 261 return -EINVAL;
262 } 262 }
263 } 263 }
264 264
@@ -594,7 +594,7 @@ xfs_file_dio_aio_write(
594 594
595 /* DIO must be aligned to device logical sector size */ 595 /* DIO must be aligned to device logical sector size */
596 if ((pos | count) & target->bt_logical_sectormask) 596 if ((pos | count) & target->bt_logical_sectormask)
597 return -XFS_ERROR(EINVAL); 597 return -EINVAL;
598 598
599 /* "unaligned" here means not aligned to a filesystem block */ 599 /* "unaligned" here means not aligned to a filesystem block */
600 if ((pos & mp->m_blockmask) || ((pos + count) & mp->m_blockmask)) 600 if ((pos & mp->m_blockmask) || ((pos + count) & mp->m_blockmask))
@@ -1282,7 +1282,7 @@ xfs_seek_hole(
1282 int error; 1282 int error;
1283 1283
1284 if (XFS_FORCED_SHUTDOWN(mp)) 1284 if (XFS_FORCED_SHUTDOWN(mp))
1285 return -XFS_ERROR(EIO); 1285 return -EIO;
1286 1286
1287 lock = xfs_ilock_data_map_shared(ip); 1287 lock = xfs_ilock_data_map_shared(ip);
1288 1288
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index d2295561570a..4334638b7b83 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -168,7 +168,7 @@ xfs_growfs_data_private(
168 nb = in->newblocks; 168 nb = in->newblocks;
169 pct = in->imaxpct; 169 pct = in->imaxpct;
170 if (nb < mp->m_sb.sb_dblocks || pct < 0 || pct > 100) 170 if (nb < mp->m_sb.sb_dblocks || pct < 0 || pct > 100)
171 return XFS_ERROR(EINVAL); 171 return EINVAL;
172 if ((error = xfs_sb_validate_fsb_count(&mp->m_sb, nb))) 172 if ((error = xfs_sb_validate_fsb_count(&mp->m_sb, nb)))
173 return error; 173 return error;
174 dpct = pct - mp->m_sb.sb_imax_pct; 174 dpct = pct - mp->m_sb.sb_imax_pct;
@@ -191,7 +191,7 @@ xfs_growfs_data_private(
191 nagcount--; 191 nagcount--;
192 nb = (xfs_rfsblock_t)nagcount * mp->m_sb.sb_agblocks; 192 nb = (xfs_rfsblock_t)nagcount * mp->m_sb.sb_agblocks;
193 if (nb < mp->m_sb.sb_dblocks) 193 if (nb < mp->m_sb.sb_dblocks)
194 return XFS_ERROR(EINVAL); 194 return EINVAL;
195 } 195 }
196 new = nb - mp->m_sb.sb_dblocks; 196 new = nb - mp->m_sb.sb_dblocks;
197 oagcount = mp->m_sb.sb_agcount; 197 oagcount = mp->m_sb.sb_agcount;
@@ -576,17 +576,17 @@ xfs_growfs_log_private(
576 576
577 nb = in->newblocks; 577 nb = in->newblocks;
578 if (nb < XFS_MIN_LOG_BLOCKS || nb < XFS_B_TO_FSB(mp, XFS_MIN_LOG_BYTES)) 578 if (nb < XFS_MIN_LOG_BLOCKS || nb < XFS_B_TO_FSB(mp, XFS_MIN_LOG_BYTES))
579 return XFS_ERROR(EINVAL); 579 return EINVAL;
580 if (nb == mp->m_sb.sb_logblocks && 580 if (nb == mp->m_sb.sb_logblocks &&
581 in->isint == (mp->m_sb.sb_logstart != 0)) 581 in->isint == (mp->m_sb.sb_logstart != 0))
582 return XFS_ERROR(EINVAL); 582 return EINVAL;
583 /* 583 /*
584 * Moving the log is hard, need new interfaces to sync 584 * Moving the log is hard, need new interfaces to sync
585 * the log first, hold off all activity while moving it. 585 * the log first, hold off all activity while moving it.
586 * Can have shorter or longer log in the same space, 586 * Can have shorter or longer log in the same space,
587 * or transform internal to external log or vice versa. 587 * or transform internal to external log or vice versa.
588 */ 588 */
589 return XFS_ERROR(ENOSYS); 589 return ENOSYS;
590} 590}
591 591
592/* 592/*
@@ -604,9 +604,9 @@ xfs_growfs_data(
604 int error; 604 int error;
605 605
606 if (!capable(CAP_SYS_ADMIN)) 606 if (!capable(CAP_SYS_ADMIN))
607 return XFS_ERROR(EPERM); 607 return EPERM;
608 if (!mutex_trylock(&mp->m_growlock)) 608 if (!mutex_trylock(&mp->m_growlock))
609 return XFS_ERROR(EWOULDBLOCK); 609 return EWOULDBLOCK;
610 error = xfs_growfs_data_private(mp, in); 610 error = xfs_growfs_data_private(mp, in);
611 mutex_unlock(&mp->m_growlock); 611 mutex_unlock(&mp->m_growlock);
612 return error; 612 return error;
@@ -620,9 +620,9 @@ xfs_growfs_log(
620 int error; 620 int error;
621 621
622 if (!capable(CAP_SYS_ADMIN)) 622 if (!capable(CAP_SYS_ADMIN))
623 return XFS_ERROR(EPERM); 623 return EPERM;
624 if (!mutex_trylock(&mp->m_growlock)) 624 if (!mutex_trylock(&mp->m_growlock))
625 return XFS_ERROR(EWOULDBLOCK); 625 return EWOULDBLOCK;
626 error = xfs_growfs_log_private(mp, in); 626 error = xfs_growfs_log_private(mp, in);
627 mutex_unlock(&mp->m_growlock); 627 mutex_unlock(&mp->m_growlock);
628 return error; 628 return error;
@@ -818,7 +818,7 @@ xfs_fs_goingdown(
818 SHUTDOWN_FORCE_UMOUNT | SHUTDOWN_LOG_IO_ERROR); 818 SHUTDOWN_FORCE_UMOUNT | SHUTDOWN_LOG_IO_ERROR);
819 break; 819 break;
820 default: 820 default:
821 return XFS_ERROR(EINVAL); 821 return EINVAL;
822 } 822 }
823 823
824 return 0; 824 return 0;
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 5960e5593fe0..16fb63a9bc5e 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -380,7 +380,7 @@ xfs_ialloc_ag_alloc(
380 newlen = args.mp->m_ialloc_inos; 380 newlen = args.mp->m_ialloc_inos;
381 if (args.mp->m_maxicount && 381 if (args.mp->m_maxicount &&
382 args.mp->m_sb.sb_icount + newlen > args.mp->m_maxicount) 382 args.mp->m_sb.sb_icount + newlen > args.mp->m_maxicount)
383 return XFS_ERROR(ENOSPC); 383 return ENOSPC;
384 args.minlen = args.maxlen = args.mp->m_ialloc_blks; 384 args.minlen = args.maxlen = args.mp->m_ialloc_blks;
385 /* 385 /*
386 * First try to allocate inodes contiguous with the last-allocated 386 * First try to allocate inodes contiguous with the last-allocated
@@ -1425,7 +1425,7 @@ out_alloc:
1425 return xfs_dialloc_ag(tp, agbp, parent, inop); 1425 return xfs_dialloc_ag(tp, agbp, parent, inop);
1426out_error: 1426out_error:
1427 xfs_perag_put(pag); 1427 xfs_perag_put(pag);
1428 return XFS_ERROR(error); 1428 return error;
1429} 1429}
1430 1430
1431STATIC int 1431STATIC int
@@ -1682,7 +1682,7 @@ xfs_difree(
1682 xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).", 1682 xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).",
1683 __func__, agno, mp->m_sb.sb_agcount); 1683 __func__, agno, mp->m_sb.sb_agcount);
1684 ASSERT(0); 1684 ASSERT(0);
1685 return XFS_ERROR(EINVAL); 1685 return EINVAL;
1686 } 1686 }
1687 agino = XFS_INO_TO_AGINO(mp, inode); 1687 agino = XFS_INO_TO_AGINO(mp, inode);
1688 if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) { 1688 if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) {
@@ -1690,14 +1690,14 @@ xfs_difree(
1690 __func__, (unsigned long long)inode, 1690 __func__, (unsigned long long)inode,
1691 (unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino)); 1691 (unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino));
1692 ASSERT(0); 1692 ASSERT(0);
1693 return XFS_ERROR(EINVAL); 1693 return EINVAL;
1694 } 1694 }
1695 agbno = XFS_AGINO_TO_AGBNO(mp, agino); 1695 agbno = XFS_AGINO_TO_AGBNO(mp, agino);
1696 if (agbno >= mp->m_sb.sb_agblocks) { 1696 if (agbno >= mp->m_sb.sb_agblocks) {
1697 xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).", 1697 xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).",
1698 __func__, agbno, mp->m_sb.sb_agblocks); 1698 __func__, agbno, mp->m_sb.sb_agblocks);
1699 ASSERT(0); 1699 ASSERT(0);
1700 return XFS_ERROR(EINVAL); 1700 return EINVAL;
1701 } 1701 }
1702 /* 1702 /*
1703 * Get the allocation group header. 1703 * Get the allocation group header.
@@ -1829,7 +1829,7 @@ xfs_imap(
1829 * as they can be invalid without implying corruption. 1829 * as they can be invalid without implying corruption.
1830 */ 1830 */
1831 if (flags & XFS_IGET_UNTRUSTED) 1831 if (flags & XFS_IGET_UNTRUSTED)
1832 return XFS_ERROR(EINVAL); 1832 return EINVAL;
1833 if (agno >= mp->m_sb.sb_agcount) { 1833 if (agno >= mp->m_sb.sb_agcount) {
1834 xfs_alert(mp, 1834 xfs_alert(mp,
1835 "%s: agno (%d) >= mp->m_sb.sb_agcount (%d)", 1835 "%s: agno (%d) >= mp->m_sb.sb_agcount (%d)",
@@ -1849,7 +1849,7 @@ xfs_imap(
1849 } 1849 }
1850 xfs_stack_trace(); 1850 xfs_stack_trace();
1851#endif /* DEBUG */ 1851#endif /* DEBUG */
1852 return XFS_ERROR(EINVAL); 1852 return EINVAL;
1853 } 1853 }
1854 1854
1855 blks_per_cluster = xfs_icluster_size_fsb(mp); 1855 blks_per_cluster = xfs_icluster_size_fsb(mp);
@@ -1922,7 +1922,7 @@ out_map:
1922 __func__, (unsigned long long) imap->im_blkno, 1922 __func__, (unsigned long long) imap->im_blkno,
1923 (unsigned long long) imap->im_len, 1923 (unsigned long long) imap->im_len,
1924 XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)); 1924 XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks));
1925 return XFS_ERROR(EINVAL); 1925 return EINVAL;
1926 } 1926 }
1927 return 0; 1927 return 0;
1928} 1928}
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index c48df5f25b9f..f2cc936d713e 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -656,7 +656,7 @@ xfs_inode_ag_iterator(
656 break; 656 break;
657 } 657 }
658 } 658 }
659 return XFS_ERROR(last_error); 659 return last_error;
660} 660}
661 661
662int 662int
@@ -684,7 +684,7 @@ xfs_inode_ag_iterator_tag(
684 break; 684 break;
685 } 685 }
686 } 686 }
687 return XFS_ERROR(last_error); 687 return last_error;
688} 688}
689 689
690/* 690/*
@@ -1129,7 +1129,7 @@ restart:
1129 trylock = 0; 1129 trylock = 0;
1130 goto restart; 1130 goto restart;
1131 } 1131 }
1132 return XFS_ERROR(last_error); 1132 return last_error;
1133} 1133}
1134 1134
1135int 1135int
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index a6115fe1ac94..605e3e1dff28 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -583,7 +583,7 @@ xfs_lookup(
583 trace_xfs_lookup(dp, name); 583 trace_xfs_lookup(dp, name);
584 584
585 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 585 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
586 return XFS_ERROR(EIO); 586 return EIO;
587 587
588 lock_mode = xfs_ilock_data_map_shared(dp); 588 lock_mode = xfs_ilock_data_map_shared(dp);
589 error = xfs_dir_lookup(NULL, dp, name, &inum, ci_name); 589 error = xfs_dir_lookup(NULL, dp, name, &inum, ci_name);
@@ -893,7 +893,7 @@ xfs_dir_ialloc(
893 } 893 }
894 if (!ialloc_context && !ip) { 894 if (!ialloc_context && !ip) {
895 *ipp = NULL; 895 *ipp = NULL;
896 return XFS_ERROR(ENOSPC); 896 return ENOSPC;
897 } 897 }
898 898
899 /* 899 /*
@@ -1088,7 +1088,7 @@ xfs_create(
1088 trace_xfs_create(dp, name); 1088 trace_xfs_create(dp, name);
1089 1089
1090 if (XFS_FORCED_SHUTDOWN(mp)) 1090 if (XFS_FORCED_SHUTDOWN(mp))
1091 return XFS_ERROR(EIO); 1091 return EIO;
1092 1092
1093 prid = xfs_get_initial_prid(dp); 1093 prid = xfs_get_initial_prid(dp);
1094 1094
@@ -1274,7 +1274,7 @@ xfs_create_tmpfile(
1274 uint resblks; 1274 uint resblks;
1275 1275
1276 if (XFS_FORCED_SHUTDOWN(mp)) 1276 if (XFS_FORCED_SHUTDOWN(mp))
1277 return XFS_ERROR(EIO); 1277 return EIO;
1278 1278
1279 prid = xfs_get_initial_prid(dp); 1279 prid = xfs_get_initial_prid(dp);
1280 1280
@@ -1382,7 +1382,7 @@ xfs_link(
1382 ASSERT(!S_ISDIR(sip->i_d.di_mode)); 1382 ASSERT(!S_ISDIR(sip->i_d.di_mode));
1383 1383
1384 if (XFS_FORCED_SHUTDOWN(mp)) 1384 if (XFS_FORCED_SHUTDOWN(mp))
1385 return XFS_ERROR(EIO); 1385 return EIO;
1386 1386
1387 error = xfs_qm_dqattach(sip, 0); 1387 error = xfs_qm_dqattach(sip, 0);
1388 if (error) 1388 if (error)
@@ -1417,7 +1417,7 @@ xfs_link(
1417 */ 1417 */
1418 if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && 1418 if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
1419 (xfs_get_projid(tdp) != xfs_get_projid(sip)))) { 1419 (xfs_get_projid(tdp) != xfs_get_projid(sip)))) {
1420 error = XFS_ERROR(EXDEV); 1420 error = EXDEV;
1421 goto error_return; 1421 goto error_return;
1422 } 1422 }
1423 1423
@@ -2491,7 +2491,7 @@ xfs_remove(
2491 trace_xfs_remove(dp, name); 2491 trace_xfs_remove(dp, name);
2492 2492
2493 if (XFS_FORCED_SHUTDOWN(mp)) 2493 if (XFS_FORCED_SHUTDOWN(mp))
2494 return XFS_ERROR(EIO); 2494 return EIO;
2495 2495
2496 error = xfs_qm_dqattach(dp, 0); 2496 error = xfs_qm_dqattach(dp, 0);
2497 if (error) 2497 if (error)
@@ -2543,11 +2543,11 @@ xfs_remove(
2543 if (is_dir) { 2543 if (is_dir) {
2544 ASSERT(ip->i_d.di_nlink >= 2); 2544 ASSERT(ip->i_d.di_nlink >= 2);
2545 if (ip->i_d.di_nlink != 2) { 2545 if (ip->i_d.di_nlink != 2) {
2546 error = XFS_ERROR(ENOTEMPTY); 2546 error = ENOTEMPTY;
2547 goto out_trans_cancel; 2547 goto out_trans_cancel;
2548 } 2548 }
2549 if (!xfs_dir_isempty(ip)) { 2549 if (!xfs_dir_isempty(ip)) {
2550 error = XFS_ERROR(ENOTEMPTY); 2550 error = ENOTEMPTY;
2551 goto out_trans_cancel; 2551 goto out_trans_cancel;
2552 } 2552 }
2553 2553
@@ -2747,7 +2747,7 @@ xfs_rename(
2747 */ 2747 */
2748 if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && 2748 if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
2749 (xfs_get_projid(target_dp) != xfs_get_projid(src_ip)))) { 2749 (xfs_get_projid(target_dp) != xfs_get_projid(src_ip)))) {
2750 error = XFS_ERROR(EXDEV); 2750 error = EXDEV;
2751 goto error_return; 2751 goto error_return;
2752 } 2752 }
2753 2753
@@ -2795,7 +2795,7 @@ xfs_rename(
2795 */ 2795 */
2796 if (!(xfs_dir_isempty(target_ip)) || 2796 if (!(xfs_dir_isempty(target_ip)) ||
2797 (target_ip->i_d.di_nlink > 2)) { 2797 (target_ip->i_d.di_nlink > 2)) {
2798 error = XFS_ERROR(EEXIST); 2798 error = EEXIST;
2799 goto error_return; 2799 goto error_return;
2800 } 2800 }
2801 } 2801 }
@@ -3069,7 +3069,7 @@ cluster_corrupt_out:
3069 xfs_iflush_abort(iq, false); 3069 xfs_iflush_abort(iq, false);
3070 kmem_free(ilist); 3070 kmem_free(ilist);
3071 xfs_perag_put(pag); 3071 xfs_perag_put(pag);
3072 return XFS_ERROR(EFSCORRUPTED); 3072 return EFSCORRUPTED;
3073} 3073}
3074 3074
3075/* 3075/*
@@ -3124,7 +3124,7 @@ xfs_iflush(
3124 * as we wait for an empty AIL as part of the unmount process. 3124 * as we wait for an empty AIL as part of the unmount process.
3125 */ 3125 */
3126 if (XFS_FORCED_SHUTDOWN(mp)) { 3126 if (XFS_FORCED_SHUTDOWN(mp)) {
3127 error = XFS_ERROR(EIO); 3127 error = EIO;
3128 goto abort_out; 3128 goto abort_out;
3129 } 3129 }
3130 3130
@@ -3167,7 +3167,7 @@ corrupt_out:
3167 xfs_buf_relse(bp); 3167 xfs_buf_relse(bp);
3168 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 3168 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
3169cluster_corrupt_out: 3169cluster_corrupt_out:
3170 error = XFS_ERROR(EFSCORRUPTED); 3170 error = EFSCORRUPTED;
3171abort_out: 3171abort_out:
3172 /* 3172 /*
3173 * Unlocks the flush lock 3173 * Unlocks the flush lock
@@ -3331,5 +3331,5 @@ xfs_iflush_int(
3331 return 0; 3331 return 0;
3332 3332
3333corrupt_out: 3333corrupt_out:
3334 return XFS_ERROR(EFSCORRUPTED); 3334 return EFSCORRUPTED;
3335} 3335}
diff --git a/fs/xfs/xfs_inode_buf.c b/fs/xfs/xfs_inode_buf.c
index cb35ae41d4a1..1e5366d7745e 100644
--- a/fs/xfs/xfs_inode_buf.c
+++ b/fs/xfs/xfs_inode_buf.c
@@ -181,7 +181,7 @@ xfs_imap_to_bp(
181 181
182 if (error == EFSCORRUPTED && 182 if (error == EFSCORRUPTED &&
183 (iget_flags & XFS_IGET_UNTRUSTED)) 183 (iget_flags & XFS_IGET_UNTRUSTED))
184 return XFS_ERROR(EINVAL); 184 return EINVAL;
185 185
186 xfs_warn(mp, "%s: xfs_trans_read_buf() returned error %d.", 186 xfs_warn(mp, "%s: xfs_trans_read_buf() returned error %d.",
187 __func__, error); 187 __func__, error);
@@ -390,7 +390,7 @@ xfs_iread(
390 __func__, ip->i_ino); 390 __func__, ip->i_ino);
391 391
392 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, dip); 392 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, dip);
393 error = XFS_ERROR(EFSCORRUPTED); 393 error = EFSCORRUPTED;
394 goto out_brelse; 394 goto out_brelse;
395 } 395 }
396 396
diff --git a/fs/xfs/xfs_inode_fork.c b/fs/xfs/xfs_inode_fork.c
index 5fc5495400bb..2a124e97f082 100644
--- a/fs/xfs/xfs_inode_fork.c
+++ b/fs/xfs/xfs_inode_fork.c
@@ -102,7 +102,7 @@ xfs_iformat_fork(
102 be64_to_cpu(dip->di_nblocks)); 102 be64_to_cpu(dip->di_nblocks));
103 XFS_CORRUPTION_ERROR("xfs_iformat(1)", XFS_ERRLEVEL_LOW, 103 XFS_CORRUPTION_ERROR("xfs_iformat(1)", XFS_ERRLEVEL_LOW,
104 ip->i_mount, dip); 104 ip->i_mount, dip);
105 return XFS_ERROR(EFSCORRUPTED); 105 return EFSCORRUPTED;
106 } 106 }
107 107
108 if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) { 108 if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) {
@@ -111,7 +111,7 @@ xfs_iformat_fork(
111 dip->di_forkoff); 111 dip->di_forkoff);
112 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW, 112 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,
113 ip->i_mount, dip); 113 ip->i_mount, dip);
114 return XFS_ERROR(EFSCORRUPTED); 114 return EFSCORRUPTED;
115 } 115 }
116 116
117 if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && 117 if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) &&
@@ -121,7 +121,7 @@ xfs_iformat_fork(
121 ip->i_ino); 121 ip->i_ino);
122 XFS_CORRUPTION_ERROR("xfs_iformat(realtime)", 122 XFS_CORRUPTION_ERROR("xfs_iformat(realtime)",
123 XFS_ERRLEVEL_LOW, ip->i_mount, dip); 123 XFS_ERRLEVEL_LOW, ip->i_mount, dip);
124 return XFS_ERROR(EFSCORRUPTED); 124 return EFSCORRUPTED;
125 } 125 }
126 126
127 switch (ip->i_d.di_mode & S_IFMT) { 127 switch (ip->i_d.di_mode & S_IFMT) {
@@ -132,7 +132,7 @@ xfs_iformat_fork(
132 if (unlikely(dip->di_format != XFS_DINODE_FMT_DEV)) { 132 if (unlikely(dip->di_format != XFS_DINODE_FMT_DEV)) {
133 XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW, 133 XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW,
134 ip->i_mount, dip); 134 ip->i_mount, dip);
135 return XFS_ERROR(EFSCORRUPTED); 135 return EFSCORRUPTED;
136 } 136 }
137 ip->i_d.di_size = 0; 137 ip->i_d.di_size = 0;
138 ip->i_df.if_u2.if_rdev = xfs_dinode_get_rdev(dip); 138 ip->i_df.if_u2.if_rdev = xfs_dinode_get_rdev(dip);
@@ -153,7 +153,7 @@ xfs_iformat_fork(
153 XFS_CORRUPTION_ERROR("xfs_iformat(4)", 153 XFS_CORRUPTION_ERROR("xfs_iformat(4)",
154 XFS_ERRLEVEL_LOW, 154 XFS_ERRLEVEL_LOW,
155 ip->i_mount, dip); 155 ip->i_mount, dip);
156 return XFS_ERROR(EFSCORRUPTED); 156 return EFSCORRUPTED;
157 } 157 }
158 158
159 di_size = be64_to_cpu(dip->di_size); 159 di_size = be64_to_cpu(dip->di_size);
@@ -166,7 +166,7 @@ xfs_iformat_fork(
166 XFS_CORRUPTION_ERROR("xfs_iformat(5)", 166 XFS_CORRUPTION_ERROR("xfs_iformat(5)",
167 XFS_ERRLEVEL_LOW, 167 XFS_ERRLEVEL_LOW,
168 ip->i_mount, dip); 168 ip->i_mount, dip);
169 return XFS_ERROR(EFSCORRUPTED); 169 return EFSCORRUPTED;
170 } 170 }
171 171
172 size = (int)di_size; 172 size = (int)di_size;
@@ -181,13 +181,13 @@ xfs_iformat_fork(
181 default: 181 default:
182 XFS_ERROR_REPORT("xfs_iformat(6)", XFS_ERRLEVEL_LOW, 182 XFS_ERROR_REPORT("xfs_iformat(6)", XFS_ERRLEVEL_LOW,
183 ip->i_mount); 183 ip->i_mount);
184 return XFS_ERROR(EFSCORRUPTED); 184 return EFSCORRUPTED;
185 } 185 }
186 break; 186 break;
187 187
188 default: 188 default:
189 XFS_ERROR_REPORT("xfs_iformat(7)", XFS_ERRLEVEL_LOW, ip->i_mount); 189 XFS_ERROR_REPORT("xfs_iformat(7)", XFS_ERRLEVEL_LOW, ip->i_mount);
190 return XFS_ERROR(EFSCORRUPTED); 190 return EFSCORRUPTED;
191 } 191 }
192 if (error) { 192 if (error) {
193 return error; 193 return error;
@@ -211,7 +211,7 @@ xfs_iformat_fork(
211 XFS_CORRUPTION_ERROR("xfs_iformat(8)", 211 XFS_CORRUPTION_ERROR("xfs_iformat(8)",
212 XFS_ERRLEVEL_LOW, 212 XFS_ERRLEVEL_LOW,
213 ip->i_mount, dip); 213 ip->i_mount, dip);
214 return XFS_ERROR(EFSCORRUPTED); 214 return EFSCORRUPTED;
215 } 215 }
216 216
217 error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size); 217 error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size);
@@ -223,7 +223,7 @@ xfs_iformat_fork(
223 error = xfs_iformat_btree(ip, dip, XFS_ATTR_FORK); 223 error = xfs_iformat_btree(ip, dip, XFS_ATTR_FORK);
224 break; 224 break;
225 default: 225 default:
226 error = XFS_ERROR(EFSCORRUPTED); 226 error = EFSCORRUPTED;
227 break; 227 break;
228 } 228 }
229 if (error) { 229 if (error) {
@@ -266,7 +266,7 @@ xfs_iformat_local(
266 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)); 266 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));
267 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW, 267 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,
268 ip->i_mount, dip); 268 ip->i_mount, dip);
269 return XFS_ERROR(EFSCORRUPTED); 269 return EFSCORRUPTED;
270 } 270 }
271 ifp = XFS_IFORK_PTR(ip, whichfork); 271 ifp = XFS_IFORK_PTR(ip, whichfork);
272 real_size = 0; 272 real_size = 0;
@@ -322,7 +322,7 @@ xfs_iformat_extents(
322 (unsigned long long) ip->i_ino, nex); 322 (unsigned long long) ip->i_ino, nex);
323 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW, 323 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW,
324 ip->i_mount, dip); 324 ip->i_mount, dip);
325 return XFS_ERROR(EFSCORRUPTED); 325 return EFSCORRUPTED;
326 } 326 }
327 327
328 ifp->if_real_bytes = 0; 328 ifp->if_real_bytes = 0;
@@ -350,7 +350,7 @@ xfs_iformat_extents(
350 XFS_ERROR_REPORT("xfs_iformat_extents(2)", 350 XFS_ERROR_REPORT("xfs_iformat_extents(2)",
351 XFS_ERRLEVEL_LOW, 351 XFS_ERRLEVEL_LOW,
352 ip->i_mount); 352 ip->i_mount);
353 return XFS_ERROR(EFSCORRUPTED); 353 return EFSCORRUPTED;
354 } 354 }
355 } 355 }
356 ifp->if_flags |= XFS_IFEXTENTS; 356 ifp->if_flags |= XFS_IFEXTENTS;
@@ -399,7 +399,7 @@ xfs_iformat_btree(
399 (unsigned long long) ip->i_ino); 399 (unsigned long long) ip->i_ino);
400 XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW, 400 XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW,
401 mp, dip); 401 mp, dip);
402 return XFS_ERROR(EFSCORRUPTED); 402 return EFSCORRUPTED;
403 } 403 }
404 404
405 ifp->if_broot_bytes = size; 405 ifp->if_broot_bytes = size;
@@ -436,7 +436,7 @@ xfs_iread_extents(
436 if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) { 436 if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) {
437 XFS_ERROR_REPORT("xfs_iread_extents", XFS_ERRLEVEL_LOW, 437 XFS_ERROR_REPORT("xfs_iread_extents", XFS_ERRLEVEL_LOW,
438 ip->i_mount); 438 ip->i_mount);
439 return XFS_ERROR(EFSCORRUPTED); 439 return EFSCORRUPTED;
440 } 440 }
441 nextents = XFS_IFORK_NEXTENTS(ip, whichfork); 441 nextents = XFS_IFORK_NEXTENTS(ip, whichfork);
442 ifp = XFS_IFORK_PTR(ip, whichfork); 442 ifp = XFS_IFORK_PTR(ip, whichfork);
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 8bc1bbce7451..1a1648fbda1c 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -207,7 +207,7 @@ xfs_open_by_handle(
207 struct path path; 207 struct path path;
208 208
209 if (!capable(CAP_SYS_ADMIN)) 209 if (!capable(CAP_SYS_ADMIN))
210 return -XFS_ERROR(EPERM); 210 return -EPERM;
211 211
212 dentry = xfs_handlereq_to_dentry(parfilp, hreq); 212 dentry = xfs_handlereq_to_dentry(parfilp, hreq);
213 if (IS_ERR(dentry)) 213 if (IS_ERR(dentry))
@@ -216,7 +216,7 @@ xfs_open_by_handle(
216 216
217 /* Restrict xfs_open_by_handle to directories & regular files. */ 217 /* Restrict xfs_open_by_handle to directories & regular files. */
218 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) { 218 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) {
219 error = -XFS_ERROR(EPERM); 219 error = -EPERM;
220 goto out_dput; 220 goto out_dput;
221 } 221 }
222 222
@@ -228,18 +228,18 @@ xfs_open_by_handle(
228 fmode = OPEN_FMODE(permflag); 228 fmode = OPEN_FMODE(permflag);
229 if ((!(permflag & O_APPEND) || (permflag & O_TRUNC)) && 229 if ((!(permflag & O_APPEND) || (permflag & O_TRUNC)) &&
230 (fmode & FMODE_WRITE) && IS_APPEND(inode)) { 230 (fmode & FMODE_WRITE) && IS_APPEND(inode)) {
231 error = -XFS_ERROR(EPERM); 231 error = -EPERM;
232 goto out_dput; 232 goto out_dput;
233 } 233 }
234 234
235 if ((fmode & FMODE_WRITE) && IS_IMMUTABLE(inode)) { 235 if ((fmode & FMODE_WRITE) && IS_IMMUTABLE(inode)) {
236 error = -XFS_ERROR(EACCES); 236 error = -EACCES;
237 goto out_dput; 237 goto out_dput;
238 } 238 }
239 239
240 /* Can't write directories. */ 240 /* Can't write directories. */
241 if (S_ISDIR(inode->i_mode) && (fmode & FMODE_WRITE)) { 241 if (S_ISDIR(inode->i_mode) && (fmode & FMODE_WRITE)) {
242 error = -XFS_ERROR(EISDIR); 242 error = -EISDIR;
243 goto out_dput; 243 goto out_dput;
244 } 244 }
245 245
@@ -282,7 +282,7 @@ xfs_readlink_by_handle(
282 int error; 282 int error;
283 283
284 if (!capable(CAP_SYS_ADMIN)) 284 if (!capable(CAP_SYS_ADMIN))
285 return -XFS_ERROR(EPERM); 285 return -EPERM;
286 286
287 dentry = xfs_handlereq_to_dentry(parfilp, hreq); 287 dentry = xfs_handlereq_to_dentry(parfilp, hreq);
288 if (IS_ERR(dentry)) 288 if (IS_ERR(dentry))
@@ -290,18 +290,18 @@ xfs_readlink_by_handle(
290 290
291 /* Restrict this handle operation to symlinks only. */ 291 /* Restrict this handle operation to symlinks only. */
292 if (!S_ISLNK(dentry->d_inode->i_mode)) { 292 if (!S_ISLNK(dentry->d_inode->i_mode)) {
293 error = -XFS_ERROR(EINVAL); 293 error = -EINVAL;
294 goto out_dput; 294 goto out_dput;
295 } 295 }
296 296
297 if (copy_from_user(&olen, hreq->ohandlen, sizeof(__u32))) { 297 if (copy_from_user(&olen, hreq->ohandlen, sizeof(__u32))) {
298 error = -XFS_ERROR(EFAULT); 298 error = -EFAULT;
299 goto out_dput; 299 goto out_dput;
300 } 300 }
301 301
302 link = kmalloc(MAXPATHLEN+1, GFP_KERNEL); 302 link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
303 if (!link) { 303 if (!link) {
304 error = -XFS_ERROR(ENOMEM); 304 error = -ENOMEM;
305 goto out_dput; 305 goto out_dput;
306 } 306 }
307 307
@@ -330,10 +330,10 @@ xfs_set_dmattrs(
330 int error; 330 int error;
331 331
332 if (!capable(CAP_SYS_ADMIN)) 332 if (!capable(CAP_SYS_ADMIN))
333 return XFS_ERROR(EPERM); 333 return EPERM;
334 334
335 if (XFS_FORCED_SHUTDOWN(mp)) 335 if (XFS_FORCED_SHUTDOWN(mp))
336 return XFS_ERROR(EIO); 336 return EIO;
337 337
338 tp = xfs_trans_alloc(mp, XFS_TRANS_SET_DMATTRS); 338 tp = xfs_trans_alloc(mp, XFS_TRANS_SET_DMATTRS);
339 error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0); 339 error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
@@ -364,9 +364,9 @@ xfs_fssetdm_by_handle(
364 struct dentry *dentry; 364 struct dentry *dentry;
365 365
366 if (!capable(CAP_MKNOD)) 366 if (!capable(CAP_MKNOD))
367 return -XFS_ERROR(EPERM); 367 return -EPERM;
368 if (copy_from_user(&dmhreq, arg, sizeof(xfs_fsop_setdm_handlereq_t))) 368 if (copy_from_user(&dmhreq, arg, sizeof(xfs_fsop_setdm_handlereq_t)))
369 return -XFS_ERROR(EFAULT); 369 return -EFAULT;
370 370
371 error = mnt_want_write_file(parfilp); 371 error = mnt_want_write_file(parfilp);
372 if (error) 372 if (error)
@@ -379,12 +379,12 @@ xfs_fssetdm_by_handle(
379 } 379 }
380 380
381 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) { 381 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) {
382 error = -XFS_ERROR(EPERM); 382 error = -EPERM;
383 goto out; 383 goto out;
384 } 384 }
385 385
386 if (copy_from_user(&fsd, dmhreq.data, sizeof(fsd))) { 386 if (copy_from_user(&fsd, dmhreq.data, sizeof(fsd))) {
387 error = -XFS_ERROR(EFAULT); 387 error = -EFAULT;
388 goto out; 388 goto out;
389 } 389 }
390 390
@@ -409,18 +409,18 @@ xfs_attrlist_by_handle(
409 char *kbuf; 409 char *kbuf;
410 410
411 if (!capable(CAP_SYS_ADMIN)) 411 if (!capable(CAP_SYS_ADMIN))
412 return -XFS_ERROR(EPERM); 412 return -EPERM;
413 if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t))) 413 if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t)))
414 return -XFS_ERROR(EFAULT); 414 return -EFAULT;
415 if (al_hreq.buflen < sizeof(struct attrlist) || 415 if (al_hreq.buflen < sizeof(struct attrlist) ||
416 al_hreq.buflen > XATTR_LIST_MAX) 416 al_hreq.buflen > XATTR_LIST_MAX)
417 return -XFS_ERROR(EINVAL); 417 return -EINVAL;
418 418
419 /* 419 /*
420 * Reject flags, only allow namespaces. 420 * Reject flags, only allow namespaces.
421 */ 421 */
422 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE)) 422 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
423 return -XFS_ERROR(EINVAL); 423 return -EINVAL;
424 424
425 dentry = xfs_handlereq_to_dentry(parfilp, &al_hreq.hreq); 425 dentry = xfs_handlereq_to_dentry(parfilp, &al_hreq.hreq);
426 if (IS_ERR(dentry)) 426 if (IS_ERR(dentry))
@@ -524,9 +524,9 @@ xfs_attrmulti_by_handle(
524 unsigned char *attr_name; 524 unsigned char *attr_name;
525 525
526 if (!capable(CAP_SYS_ADMIN)) 526 if (!capable(CAP_SYS_ADMIN))
527 return -XFS_ERROR(EPERM); 527 return -EPERM;
528 if (copy_from_user(&am_hreq, arg, sizeof(xfs_fsop_attrmulti_handlereq_t))) 528 if (copy_from_user(&am_hreq, arg, sizeof(xfs_fsop_attrmulti_handlereq_t)))
529 return -XFS_ERROR(EFAULT); 529 return -EFAULT;
530 530
531 /* overflow check */ 531 /* overflow check */
532 if (am_hreq.opcount >= INT_MAX / sizeof(xfs_attr_multiop_t)) 532 if (am_hreq.opcount >= INT_MAX / sizeof(xfs_attr_multiop_t))
@@ -593,7 +593,7 @@ xfs_attrmulti_by_handle(
593 } 593 }
594 594
595 if (copy_to_user(am_hreq.ops, ops, size)) 595 if (copy_to_user(am_hreq.ops, ops, size))
596 error = XFS_ERROR(EFAULT); 596 error = EFAULT;
597 597
598 kfree(attr_name); 598 kfree(attr_name);
599 out_kfree_ops: 599 out_kfree_ops:
@@ -625,16 +625,16 @@ xfs_ioc_space(
625 */ 625 */
626 if (!xfs_sb_version_hasextflgbit(&ip->i_mount->m_sb) && 626 if (!xfs_sb_version_hasextflgbit(&ip->i_mount->m_sb) &&
627 !capable(CAP_SYS_ADMIN)) 627 !capable(CAP_SYS_ADMIN))
628 return -XFS_ERROR(EPERM); 628 return -EPERM;
629 629
630 if (inode->i_flags & (S_IMMUTABLE|S_APPEND)) 630 if (inode->i_flags & (S_IMMUTABLE|S_APPEND))
631 return -XFS_ERROR(EPERM); 631 return -EPERM;
632 632
633 if (!(filp->f_mode & FMODE_WRITE)) 633 if (!(filp->f_mode & FMODE_WRITE))
634 return -XFS_ERROR(EBADF); 634 return -EBADF;
635 635
636 if (!S_ISREG(inode->i_mode)) 636 if (!S_ISREG(inode->i_mode))
637 return -XFS_ERROR(EINVAL); 637 return -EINVAL;
638 638
639 error = mnt_want_write_file(filp); 639 error = mnt_want_write_file(filp);
640 if (error) 640 if (error)
@@ -652,7 +652,7 @@ xfs_ioc_space(
652 bf->l_start += XFS_ISIZE(ip); 652 bf->l_start += XFS_ISIZE(ip);
653 break; 653 break;
654 default: 654 default:
655 error = XFS_ERROR(EINVAL); 655 error = EINVAL;
656 goto out_unlock; 656 goto out_unlock;
657 } 657 }
658 658
@@ -669,7 +669,7 @@ xfs_ioc_space(
669 case XFS_IOC_UNRESVSP: 669 case XFS_IOC_UNRESVSP:
670 case XFS_IOC_UNRESVSP64: 670 case XFS_IOC_UNRESVSP64:
671 if (bf->l_len <= 0) { 671 if (bf->l_len <= 0) {
672 error = XFS_ERROR(EINVAL); 672 error = EINVAL;
673 goto out_unlock; 673 goto out_unlock;
674 } 674 }
675 break; 675 break;
@@ -682,7 +682,7 @@ xfs_ioc_space(
682 bf->l_start > mp->m_super->s_maxbytes || 682 bf->l_start > mp->m_super->s_maxbytes ||
683 bf->l_start + bf->l_len < 0 || 683 bf->l_start + bf->l_len < 0 ||
684 bf->l_start + bf->l_len >= mp->m_super->s_maxbytes) { 684 bf->l_start + bf->l_len >= mp->m_super->s_maxbytes) {
685 error = XFS_ERROR(EINVAL); 685 error = EINVAL;
686 goto out_unlock; 686 goto out_unlock;
687 } 687 }
688 688
@@ -723,7 +723,7 @@ xfs_ioc_space(
723 break; 723 break;
724 default: 724 default:
725 ASSERT(0); 725 ASSERT(0);
726 error = XFS_ERROR(EINVAL); 726 error = EINVAL;
727 } 727 }
728 728
729 if (error) 729 if (error)
@@ -781,19 +781,19 @@ xfs_ioc_bulkstat(
781 return -EPERM; 781 return -EPERM;
782 782
783 if (XFS_FORCED_SHUTDOWN(mp)) 783 if (XFS_FORCED_SHUTDOWN(mp))
784 return -XFS_ERROR(EIO); 784 return -EIO;
785 785
786 if (copy_from_user(&bulkreq, arg, sizeof(xfs_fsop_bulkreq_t))) 786 if (copy_from_user(&bulkreq, arg, sizeof(xfs_fsop_bulkreq_t)))
787 return -XFS_ERROR(EFAULT); 787 return -EFAULT;
788 788
789 if (copy_from_user(&inlast, bulkreq.lastip, sizeof(__s64))) 789 if (copy_from_user(&inlast, bulkreq.lastip, sizeof(__s64)))
790 return -XFS_ERROR(EFAULT); 790 return -EFAULT;
791 791
792 if ((count = bulkreq.icount) <= 0) 792 if ((count = bulkreq.icount) <= 0)
793 return -XFS_ERROR(EINVAL); 793 return -EINVAL;
794 794
795 if (bulkreq.ubuffer == NULL) 795 if (bulkreq.ubuffer == NULL)
796 return -XFS_ERROR(EINVAL); 796 return -EINVAL;
797 797
798 if (cmd == XFS_IOC_FSINUMBERS) 798 if (cmd == XFS_IOC_FSINUMBERS)
799 error = xfs_inumbers(mp, &inlast, &count, 799 error = xfs_inumbers(mp, &inlast, &count,
@@ -812,10 +812,10 @@ xfs_ioc_bulkstat(
812 if (bulkreq.ocount != NULL) { 812 if (bulkreq.ocount != NULL) {
813 if (copy_to_user(bulkreq.lastip, &inlast, 813 if (copy_to_user(bulkreq.lastip, &inlast,
814 sizeof(xfs_ino_t))) 814 sizeof(xfs_ino_t)))
815 return -XFS_ERROR(EFAULT); 815 return -EFAULT;
816 816
817 if (copy_to_user(bulkreq.ocount, &count, sizeof(count))) 817 if (copy_to_user(bulkreq.ocount, &count, sizeof(count)))
818 return -XFS_ERROR(EFAULT); 818 return -EFAULT;
819 } 819 }
820 820
821 return 0; 821 return 0;
@@ -839,7 +839,7 @@ xfs_ioc_fsgeometry_v1(
839 * xfs_fsop_geom_t that xfs_fs_geometry() fills in. 839 * xfs_fsop_geom_t that xfs_fs_geometry() fills in.
840 */ 840 */
841 if (copy_to_user(arg, &fsgeo, sizeof(xfs_fsop_geom_v1_t))) 841 if (copy_to_user(arg, &fsgeo, sizeof(xfs_fsop_geom_v1_t)))
842 return -XFS_ERROR(EFAULT); 842 return -EFAULT;
843 return 0; 843 return 0;
844} 844}
845 845
@@ -856,7 +856,7 @@ xfs_ioc_fsgeometry(
856 return -error; 856 return -error;
857 857
858 if (copy_to_user(arg, &fsgeo, sizeof(fsgeo))) 858 if (copy_to_user(arg, &fsgeo, sizeof(fsgeo)))
859 return -XFS_ERROR(EFAULT); 859 return -EFAULT;
860 return 0; 860 return 0;
861} 861}
862 862
@@ -1041,16 +1041,16 @@ xfs_ioctl_setattr(
1041 trace_xfs_ioctl_setattr(ip); 1041 trace_xfs_ioctl_setattr(ip);
1042 1042
1043 if (mp->m_flags & XFS_MOUNT_RDONLY) 1043 if (mp->m_flags & XFS_MOUNT_RDONLY)
1044 return XFS_ERROR(EROFS); 1044 return EROFS;
1045 if (XFS_FORCED_SHUTDOWN(mp)) 1045 if (XFS_FORCED_SHUTDOWN(mp))
1046 return XFS_ERROR(EIO); 1046 return EIO;
1047 1047
1048 /* 1048 /*
1049 * Disallow 32bit project ids when projid32bit feature is not enabled. 1049 * Disallow 32bit project ids when projid32bit feature is not enabled.
1050 */ 1050 */
1051 if ((mask & FSX_PROJID) && (fa->fsx_projid > (__uint16_t)-1) && 1051 if ((mask & FSX_PROJID) && (fa->fsx_projid > (__uint16_t)-1) &&
1052 !xfs_sb_version_hasprojid32bit(&ip->i_mount->m_sb)) 1052 !xfs_sb_version_hasprojid32bit(&ip->i_mount->m_sb))
1053 return XFS_ERROR(EINVAL); 1053 return EINVAL;
1054 1054
1055 /* 1055 /*
1056 * If disk quotas is on, we make sure that the dquots do exist on disk, 1056 * If disk quotas is on, we make sure that the dquots do exist on disk,
@@ -1088,7 +1088,7 @@ xfs_ioctl_setattr(
1088 * CAP_FSETID capability is applicable. 1088 * CAP_FSETID capability is applicable.
1089 */ 1089 */
1090 if (!inode_owner_or_capable(VFS_I(ip))) { 1090 if (!inode_owner_or_capable(VFS_I(ip))) {
1091 code = XFS_ERROR(EPERM); 1091 code = EPERM;
1092 goto error_return; 1092 goto error_return;
1093 } 1093 }
1094 1094
@@ -1099,7 +1099,7 @@ xfs_ioctl_setattr(
1099 */ 1099 */
1100 if (mask & FSX_PROJID) { 1100 if (mask & FSX_PROJID) {
1101 if (current_user_ns() != &init_user_ns) { 1101 if (current_user_ns() != &init_user_ns) {
1102 code = XFS_ERROR(EINVAL); 1102 code = EINVAL;
1103 goto error_return; 1103 goto error_return;
1104 } 1104 }
1105 1105
@@ -1122,7 +1122,7 @@ xfs_ioctl_setattr(
1122 if (ip->i_d.di_nextents && 1122 if (ip->i_d.di_nextents &&
1123 ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != 1123 ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) !=
1124 fa->fsx_extsize)) { 1124 fa->fsx_extsize)) {
1125 code = XFS_ERROR(EINVAL); /* EFBIG? */ 1125 code = EINVAL; /* EFBIG? */
1126 goto error_return; 1126 goto error_return;
1127 } 1127 }
1128 1128
@@ -1141,7 +1141,7 @@ xfs_ioctl_setattr(
1141 1141
1142 extsize_fsb = XFS_B_TO_FSB(mp, fa->fsx_extsize); 1142 extsize_fsb = XFS_B_TO_FSB(mp, fa->fsx_extsize);
1143 if (extsize_fsb > MAXEXTLEN) { 1143 if (extsize_fsb > MAXEXTLEN) {
1144 code = XFS_ERROR(EINVAL); 1144 code = EINVAL;
1145 goto error_return; 1145 goto error_return;
1146 } 1146 }
1147 1147
@@ -1153,13 +1153,13 @@ xfs_ioctl_setattr(
1153 } else { 1153 } else {
1154 size = mp->m_sb.sb_blocksize; 1154 size = mp->m_sb.sb_blocksize;
1155 if (extsize_fsb > mp->m_sb.sb_agblocks / 2) { 1155 if (extsize_fsb > mp->m_sb.sb_agblocks / 2) {
1156 code = XFS_ERROR(EINVAL); 1156 code = EINVAL;
1157 goto error_return; 1157 goto error_return;
1158 } 1158 }
1159 } 1159 }
1160 1160
1161 if (fa->fsx_extsize % size) { 1161 if (fa->fsx_extsize % size) {
1162 code = XFS_ERROR(EINVAL); 1162 code = EINVAL;
1163 goto error_return; 1163 goto error_return;
1164 } 1164 }
1165 } 1165 }
@@ -1173,7 +1173,7 @@ xfs_ioctl_setattr(
1173 if ((ip->i_d.di_nextents || ip->i_delayed_blks) && 1173 if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
1174 (XFS_IS_REALTIME_INODE(ip)) != 1174 (XFS_IS_REALTIME_INODE(ip)) !=
1175 (fa->fsx_xflags & XFS_XFLAG_REALTIME)) { 1175 (fa->fsx_xflags & XFS_XFLAG_REALTIME)) {
1176 code = XFS_ERROR(EINVAL); /* EFBIG? */ 1176 code = EINVAL; /* EFBIG? */
1177 goto error_return; 1177 goto error_return;
1178 } 1178 }
1179 1179
@@ -1184,7 +1184,7 @@ xfs_ioctl_setattr(
1184 if ((mp->m_sb.sb_rblocks == 0) || 1184 if ((mp->m_sb.sb_rblocks == 0) ||
1185 (mp->m_sb.sb_rextsize == 0) || 1185 (mp->m_sb.sb_rextsize == 0) ||
1186 (ip->i_d.di_extsize % mp->m_sb.sb_rextsize)) { 1186 (ip->i_d.di_extsize % mp->m_sb.sb_rextsize)) {
1187 code = XFS_ERROR(EINVAL); 1187 code = EINVAL;
1188 goto error_return; 1188 goto error_return;
1189 } 1189 }
1190 } 1190 }
@@ -1198,7 +1198,7 @@ xfs_ioctl_setattr(
1198 (fa->fsx_xflags & 1198 (fa->fsx_xflags &
1199 (XFS_XFLAG_IMMUTABLE | XFS_XFLAG_APPEND))) && 1199 (XFS_XFLAG_IMMUTABLE | XFS_XFLAG_APPEND))) &&
1200 !capable(CAP_LINUX_IMMUTABLE)) { 1200 !capable(CAP_LINUX_IMMUTABLE)) {
1201 code = XFS_ERROR(EPERM); 1201 code = EPERM;
1202 goto error_return; 1202 goto error_return;
1203 } 1203 }
1204 } 1204 }
@@ -1356,7 +1356,7 @@ xfs_getbmap_format(void **ap, struct getbmapx *bmv, int *full)
1356 1356
1357 /* copy only getbmap portion (not getbmapx) */ 1357 /* copy only getbmap portion (not getbmapx) */
1358 if (copy_to_user(base, bmv, sizeof(struct getbmap))) 1358 if (copy_to_user(base, bmv, sizeof(struct getbmap)))
1359 return XFS_ERROR(EFAULT); 1359 return EFAULT;
1360 1360
1361 *ap += sizeof(struct getbmap); 1361 *ap += sizeof(struct getbmap);
1362 return 0; 1362 return 0;
@@ -1373,10 +1373,10 @@ xfs_ioc_getbmap(
1373 int error; 1373 int error;
1374 1374
1375 if (copy_from_user(&bmx, arg, sizeof(struct getbmapx))) 1375 if (copy_from_user(&bmx, arg, sizeof(struct getbmapx)))
1376 return -XFS_ERROR(EFAULT); 1376 return -EFAULT;
1377 1377
1378 if (bmx.bmv_count < 2) 1378 if (bmx.bmv_count < 2)
1379 return -XFS_ERROR(EINVAL); 1379 return -EINVAL;
1380 1380
1381 bmx.bmv_iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0); 1381 bmx.bmv_iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0);
1382 if (ioflags & IO_INVIS) 1382 if (ioflags & IO_INVIS)
@@ -1389,7 +1389,7 @@ xfs_ioc_getbmap(
1389 1389
1390 /* copy back header - only size of getbmap */ 1390 /* copy back header - only size of getbmap */
1391 if (copy_to_user(arg, &bmx, sizeof(struct getbmap))) 1391 if (copy_to_user(arg, &bmx, sizeof(struct getbmap)))
1392 return -XFS_ERROR(EFAULT); 1392 return -EFAULT;
1393 return 0; 1393 return 0;
1394} 1394}
1395 1395
@@ -1399,7 +1399,7 @@ xfs_getbmapx_format(void **ap, struct getbmapx *bmv, int *full)
1399 struct getbmapx __user *base = *ap; 1399 struct getbmapx __user *base = *ap;
1400 1400
1401 if (copy_to_user(base, bmv, sizeof(struct getbmapx))) 1401 if (copy_to_user(base, bmv, sizeof(struct getbmapx)))
1402 return XFS_ERROR(EFAULT); 1402 return EFAULT;
1403 1403
1404 *ap += sizeof(struct getbmapx); 1404 *ap += sizeof(struct getbmapx);
1405 return 0; 1405 return 0;
@@ -1414,13 +1414,13 @@ xfs_ioc_getbmapx(
1414 int error; 1414 int error;
1415 1415
1416 if (copy_from_user(&bmx, arg, sizeof(bmx))) 1416 if (copy_from_user(&bmx, arg, sizeof(bmx)))
1417 return -XFS_ERROR(EFAULT); 1417 return -EFAULT;
1418 1418
1419 if (bmx.bmv_count < 2) 1419 if (bmx.bmv_count < 2)
1420 return -XFS_ERROR(EINVAL); 1420 return -EINVAL;
1421 1421
1422 if (bmx.bmv_iflags & (~BMV_IF_VALID)) 1422 if (bmx.bmv_iflags & (~BMV_IF_VALID))
1423 return -XFS_ERROR(EINVAL); 1423 return -EINVAL;
1424 1424
1425 error = xfs_getbmap(ip, &bmx, xfs_getbmapx_format, 1425 error = xfs_getbmap(ip, &bmx, xfs_getbmapx_format,
1426 (struct getbmapx *)arg+1); 1426 (struct getbmapx *)arg+1);
@@ -1429,7 +1429,7 @@ xfs_ioc_getbmapx(
1429 1429
1430 /* copy back header */ 1430 /* copy back header */
1431 if (copy_to_user(arg, &bmx, sizeof(struct getbmapx))) 1431 if (copy_to_user(arg, &bmx, sizeof(struct getbmapx)))
1432 return -XFS_ERROR(EFAULT); 1432 return -EFAULT;
1433 1433
1434 return 0; 1434 return 0;
1435} 1435}
@@ -1445,33 +1445,33 @@ xfs_ioc_swapext(
1445 /* Pull information for the target fd */ 1445 /* Pull information for the target fd */
1446 f = fdget((int)sxp->sx_fdtarget); 1446 f = fdget((int)sxp->sx_fdtarget);
1447 if (!f.file) { 1447 if (!f.file) {
1448 error = XFS_ERROR(EINVAL); 1448 error = EINVAL;
1449 goto out; 1449 goto out;
1450 } 1450 }
1451 1451
1452 if (!(f.file->f_mode & FMODE_WRITE) || 1452 if (!(f.file->f_mode & FMODE_WRITE) ||
1453 !(f.file->f_mode & FMODE_READ) || 1453 !(f.file->f_mode & FMODE_READ) ||
1454 (f.file->f_flags & O_APPEND)) { 1454 (f.file->f_flags & O_APPEND)) {
1455 error = XFS_ERROR(EBADF); 1455 error = EBADF;
1456 goto out_put_file; 1456 goto out_put_file;
1457 } 1457 }
1458 1458
1459 tmp = fdget((int)sxp->sx_fdtmp); 1459 tmp = fdget((int)sxp->sx_fdtmp);
1460 if (!tmp.file) { 1460 if (!tmp.file) {
1461 error = XFS_ERROR(EINVAL); 1461 error = EINVAL;
1462 goto out_put_file; 1462 goto out_put_file;
1463 } 1463 }
1464 1464
1465 if (!(tmp.file->f_mode & FMODE_WRITE) || 1465 if (!(tmp.file->f_mode & FMODE_WRITE) ||
1466 !(tmp.file->f_mode & FMODE_READ) || 1466 !(tmp.file->f_mode & FMODE_READ) ||
1467 (tmp.file->f_flags & O_APPEND)) { 1467 (tmp.file->f_flags & O_APPEND)) {
1468 error = XFS_ERROR(EBADF); 1468 error = EBADF;
1469 goto out_put_tmp_file; 1469 goto out_put_tmp_file;
1470 } 1470 }
1471 1471
1472 if (IS_SWAPFILE(file_inode(f.file)) || 1472 if (IS_SWAPFILE(file_inode(f.file)) ||
1473 IS_SWAPFILE(file_inode(tmp.file))) { 1473 IS_SWAPFILE(file_inode(tmp.file))) {
1474 error = XFS_ERROR(EINVAL); 1474 error = EINVAL;
1475 goto out_put_tmp_file; 1475 goto out_put_tmp_file;
1476 } 1476 }
1477 1477
@@ -1479,17 +1479,17 @@ xfs_ioc_swapext(
1479 tip = XFS_I(file_inode(tmp.file)); 1479 tip = XFS_I(file_inode(tmp.file));
1480 1480
1481 if (ip->i_mount != tip->i_mount) { 1481 if (ip->i_mount != tip->i_mount) {
1482 error = XFS_ERROR(EINVAL); 1482 error = EINVAL;
1483 goto out_put_tmp_file; 1483 goto out_put_tmp_file;
1484 } 1484 }
1485 1485
1486 if (ip->i_ino == tip->i_ino) { 1486 if (ip->i_ino == tip->i_ino) {
1487 error = XFS_ERROR(EINVAL); 1487 error = EINVAL;
1488 goto out_put_tmp_file; 1488 goto out_put_tmp_file;
1489 } 1489 }
1490 1490
1491 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { 1491 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
1492 error = XFS_ERROR(EIO); 1492 error = EIO;
1493 goto out_put_tmp_file; 1493 goto out_put_tmp_file;
1494 } 1494 }
1495 1495
@@ -1542,7 +1542,7 @@ xfs_file_ioctl(
1542 xfs_flock64_t bf; 1542 xfs_flock64_t bf;
1543 1543
1544 if (copy_from_user(&bf, arg, sizeof(bf))) 1544 if (copy_from_user(&bf, arg, sizeof(bf)))
1545 return -XFS_ERROR(EFAULT); 1545 return -EFAULT;
1546 return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf); 1546 return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf);
1547 } 1547 }
1548 case XFS_IOC_DIOINFO: { 1548 case XFS_IOC_DIOINFO: {
@@ -1555,7 +1555,7 @@ xfs_file_ioctl(
1555 da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1); 1555 da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1);
1556 1556
1557 if (copy_to_user(arg, &da, sizeof(da))) 1557 if (copy_to_user(arg, &da, sizeof(da)))
1558 return -XFS_ERROR(EFAULT); 1558 return -EFAULT;
1559 return 0; 1559 return 0;
1560 } 1560 }
1561 1561
@@ -1588,7 +1588,7 @@ xfs_file_ioctl(
1588 struct fsdmidata dmi; 1588 struct fsdmidata dmi;
1589 1589
1590 if (copy_from_user(&dmi, arg, sizeof(dmi))) 1590 if (copy_from_user(&dmi, arg, sizeof(dmi)))
1591 return -XFS_ERROR(EFAULT); 1591 return -EFAULT;
1592 1592
1593 error = mnt_want_write_file(filp); 1593 error = mnt_want_write_file(filp);
1594 if (error) 1594 if (error)
@@ -1613,14 +1613,14 @@ xfs_file_ioctl(
1613 xfs_fsop_handlereq_t hreq; 1613 xfs_fsop_handlereq_t hreq;
1614 1614
1615 if (copy_from_user(&hreq, arg, sizeof(hreq))) 1615 if (copy_from_user(&hreq, arg, sizeof(hreq)))
1616 return -XFS_ERROR(EFAULT); 1616 return -EFAULT;
1617 return xfs_find_handle(cmd, &hreq); 1617 return xfs_find_handle(cmd, &hreq);
1618 } 1618 }
1619 case XFS_IOC_OPEN_BY_HANDLE: { 1619 case XFS_IOC_OPEN_BY_HANDLE: {
1620 xfs_fsop_handlereq_t hreq; 1620 xfs_fsop_handlereq_t hreq;
1621 1621
1622 if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t))) 1622 if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
1623 return -XFS_ERROR(EFAULT); 1623 return -EFAULT;
1624 return xfs_open_by_handle(filp, &hreq); 1624 return xfs_open_by_handle(filp, &hreq);
1625 } 1625 }
1626 case XFS_IOC_FSSETDM_BY_HANDLE: 1626 case XFS_IOC_FSSETDM_BY_HANDLE:
@@ -1630,7 +1630,7 @@ xfs_file_ioctl(
1630 xfs_fsop_handlereq_t hreq; 1630 xfs_fsop_handlereq_t hreq;
1631 1631
1632 if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t))) 1632 if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
1633 return -XFS_ERROR(EFAULT); 1633 return -EFAULT;
1634 return xfs_readlink_by_handle(filp, &hreq); 1634 return xfs_readlink_by_handle(filp, &hreq);
1635 } 1635 }
1636 case XFS_IOC_ATTRLIST_BY_HANDLE: 1636 case XFS_IOC_ATTRLIST_BY_HANDLE:
@@ -1643,7 +1643,7 @@ xfs_file_ioctl(
1643 struct xfs_swapext sxp; 1643 struct xfs_swapext sxp;
1644 1644
1645 if (copy_from_user(&sxp, arg, sizeof(xfs_swapext_t))) 1645 if (copy_from_user(&sxp, arg, sizeof(xfs_swapext_t)))
1646 return -XFS_ERROR(EFAULT); 1646 return -EFAULT;
1647 error = mnt_want_write_file(filp); 1647 error = mnt_want_write_file(filp);
1648 if (error) 1648 if (error)
1649 return error; 1649 return error;
@@ -1660,7 +1660,7 @@ xfs_file_ioctl(
1660 return -error; 1660 return -error;
1661 1661
1662 if (copy_to_user(arg, &out, sizeof(out))) 1662 if (copy_to_user(arg, &out, sizeof(out)))
1663 return -XFS_ERROR(EFAULT); 1663 return -EFAULT;
1664 return 0; 1664 return 0;
1665 } 1665 }
1666 1666
@@ -1672,10 +1672,10 @@ xfs_file_ioctl(
1672 return -EPERM; 1672 return -EPERM;
1673 1673
1674 if (mp->m_flags & XFS_MOUNT_RDONLY) 1674 if (mp->m_flags & XFS_MOUNT_RDONLY)
1675 return -XFS_ERROR(EROFS); 1675 return -EROFS;
1676 1676
1677 if (copy_from_user(&inout, arg, sizeof(inout))) 1677 if (copy_from_user(&inout, arg, sizeof(inout)))
1678 return -XFS_ERROR(EFAULT); 1678 return -EFAULT;
1679 1679
1680 error = mnt_want_write_file(filp); 1680 error = mnt_want_write_file(filp);
1681 if (error) 1681 if (error)
@@ -1689,7 +1689,7 @@ xfs_file_ioctl(
1689 return -error; 1689 return -error;
1690 1690
1691 if (copy_to_user(arg, &inout, sizeof(inout))) 1691 if (copy_to_user(arg, &inout, sizeof(inout)))
1692 return -XFS_ERROR(EFAULT); 1692 return -EFAULT;
1693 return 0; 1693 return 0;
1694 } 1694 }
1695 1695
@@ -1704,7 +1704,7 @@ xfs_file_ioctl(
1704 return -error; 1704 return -error;
1705 1705
1706 if (copy_to_user(arg, &out, sizeof(out))) 1706 if (copy_to_user(arg, &out, sizeof(out)))
1707 return -XFS_ERROR(EFAULT); 1707 return -EFAULT;
1708 1708
1709 return 0; 1709 return 0;
1710 } 1710 }
@@ -1713,7 +1713,7 @@ xfs_file_ioctl(
1713 xfs_growfs_data_t in; 1713 xfs_growfs_data_t in;
1714 1714
1715 if (copy_from_user(&in, arg, sizeof(in))) 1715 if (copy_from_user(&in, arg, sizeof(in)))
1716 return -XFS_ERROR(EFAULT); 1716 return -EFAULT;
1717 1717
1718 error = mnt_want_write_file(filp); 1718 error = mnt_want_write_file(filp);
1719 if (error) 1719 if (error)
@@ -1727,7 +1727,7 @@ xfs_file_ioctl(
1727 xfs_growfs_log_t in; 1727 xfs_growfs_log_t in;
1728 1728
1729 if (copy_from_user(&in, arg, sizeof(in))) 1729 if (copy_from_user(&in, arg, sizeof(in)))
1730 return -XFS_ERROR(EFAULT); 1730 return -EFAULT;
1731 1731
1732 error = mnt_want_write_file(filp); 1732 error = mnt_want_write_file(filp);
1733 if (error) 1733 if (error)
@@ -1741,7 +1741,7 @@ xfs_file_ioctl(
1741 xfs_growfs_rt_t in; 1741 xfs_growfs_rt_t in;
1742 1742
1743 if (copy_from_user(&in, arg, sizeof(in))) 1743 if (copy_from_user(&in, arg, sizeof(in)))
1744 return -XFS_ERROR(EFAULT); 1744 return -EFAULT;
1745 1745
1746 error = mnt_want_write_file(filp); 1746 error = mnt_want_write_file(filp);
1747 if (error) 1747 if (error)
@@ -1758,7 +1758,7 @@ xfs_file_ioctl(
1758 return -EPERM; 1758 return -EPERM;
1759 1759
1760 if (get_user(in, (__uint32_t __user *)arg)) 1760 if (get_user(in, (__uint32_t __user *)arg))
1761 return -XFS_ERROR(EFAULT); 1761 return -EFAULT;
1762 1762
1763 error = xfs_fs_goingdown(mp, in); 1763 error = xfs_fs_goingdown(mp, in);
1764 return -error; 1764 return -error;
@@ -1771,7 +1771,7 @@ xfs_file_ioctl(
1771 return -EPERM; 1771 return -EPERM;
1772 1772
1773 if (copy_from_user(&in, arg, sizeof(in))) 1773 if (copy_from_user(&in, arg, sizeof(in)))
1774 return -XFS_ERROR(EFAULT); 1774 return -EFAULT;
1775 1775
1776 error = xfs_errortag_add(in.errtag, mp); 1776 error = xfs_errortag_add(in.errtag, mp);
1777 return -error; 1777 return -error;
@@ -1792,10 +1792,10 @@ xfs_file_ioctl(
1792 return -EPERM; 1792 return -EPERM;
1793 1793
1794 if (mp->m_flags & XFS_MOUNT_RDONLY) 1794 if (mp->m_flags & XFS_MOUNT_RDONLY)
1795 return -XFS_ERROR(EROFS); 1795 return -EROFS;
1796 1796
1797 if (copy_from_user(&eofb, arg, sizeof(eofb))) 1797 if (copy_from_user(&eofb, arg, sizeof(eofb)))
1798 return -XFS_ERROR(EFAULT); 1798 return -EFAULT;
1799 1799
1800 error = xfs_fs_eofblocks_from_user(&eofb, &keofb); 1800 error = xfs_fs_eofblocks_from_user(&eofb, &keofb);
1801 if (error) 1801 if (error)
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 944d5baa710a..357963ec9ba6 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -56,7 +56,7 @@ xfs_compat_flock64_copyin(
56 get_user(bf->l_sysid, &arg32->l_sysid) || 56 get_user(bf->l_sysid, &arg32->l_sysid) ||
57 get_user(bf->l_pid, &arg32->l_pid) || 57 get_user(bf->l_pid, &arg32->l_pid) ||
58 copy_from_user(bf->l_pad, &arg32->l_pad, 4*sizeof(u32))) 58 copy_from_user(bf->l_pad, &arg32->l_pad, 4*sizeof(u32)))
59 return -XFS_ERROR(EFAULT); 59 return -EFAULT;
60 return 0; 60 return 0;
61} 61}
62 62
@@ -73,7 +73,7 @@ xfs_compat_ioc_fsgeometry_v1(
73 return -error; 73 return -error;
74 /* The 32-bit variant simply has some padding at the end */ 74 /* The 32-bit variant simply has some padding at the end */
75 if (copy_to_user(arg32, &fsgeo, sizeof(struct compat_xfs_fsop_geom_v1))) 75 if (copy_to_user(arg32, &fsgeo, sizeof(struct compat_xfs_fsop_geom_v1)))
76 return -XFS_ERROR(EFAULT); 76 return -EFAULT;
77 return 0; 77 return 0;
78} 78}
79 79
@@ -84,7 +84,7 @@ xfs_compat_growfs_data_copyin(
84{ 84{
85 if (get_user(in->newblocks, &arg32->newblocks) || 85 if (get_user(in->newblocks, &arg32->newblocks) ||
86 get_user(in->imaxpct, &arg32->imaxpct)) 86 get_user(in->imaxpct, &arg32->imaxpct))
87 return -XFS_ERROR(EFAULT); 87 return -EFAULT;
88 return 0; 88 return 0;
89} 89}
90 90
@@ -95,7 +95,7 @@ xfs_compat_growfs_rt_copyin(
95{ 95{
96 if (get_user(in->newblocks, &arg32->newblocks) || 96 if (get_user(in->newblocks, &arg32->newblocks) ||
97 get_user(in->extsize, &arg32->extsize)) 97 get_user(in->extsize, &arg32->extsize))
98 return -XFS_ERROR(EFAULT); 98 return -EFAULT;
99 return 0; 99 return 0;
100} 100}
101 101
@@ -113,7 +113,7 @@ xfs_inumbers_fmt_compat(
113 if (put_user(buffer[i].xi_startino, &p32[i].xi_startino) || 113 if (put_user(buffer[i].xi_startino, &p32[i].xi_startino) ||
114 put_user(buffer[i].xi_alloccount, &p32[i].xi_alloccount) || 114 put_user(buffer[i].xi_alloccount, &p32[i].xi_alloccount) ||
115 put_user(buffer[i].xi_allocmask, &p32[i].xi_allocmask)) 115 put_user(buffer[i].xi_allocmask, &p32[i].xi_allocmask))
116 return -XFS_ERROR(EFAULT); 116 return -EFAULT;
117 } 117 }
118 *written = count * sizeof(*p32); 118 *written = count * sizeof(*p32);
119 return 0; 119 return 0;
@@ -132,7 +132,7 @@ xfs_ioctl32_bstime_copyin(
132 132
133 if (get_user(sec32, &bstime32->tv_sec) || 133 if (get_user(sec32, &bstime32->tv_sec) ||
134 get_user(bstime->tv_nsec, &bstime32->tv_nsec)) 134 get_user(bstime->tv_nsec, &bstime32->tv_nsec))
135 return -XFS_ERROR(EFAULT); 135 return -EFAULT;
136 bstime->tv_sec = sec32; 136 bstime->tv_sec = sec32;
137 return 0; 137 return 0;
138} 138}
@@ -164,7 +164,7 @@ xfs_ioctl32_bstat_copyin(
164 get_user(bstat->bs_dmevmask, &bstat32->bs_dmevmask) || 164 get_user(bstat->bs_dmevmask, &bstat32->bs_dmevmask) ||
165 get_user(bstat->bs_dmstate, &bstat32->bs_dmstate) || 165 get_user(bstat->bs_dmstate, &bstat32->bs_dmstate) ||
166 get_user(bstat->bs_aextents, &bstat32->bs_aextents)) 166 get_user(bstat->bs_aextents, &bstat32->bs_aextents))
167 return -XFS_ERROR(EFAULT); 167 return -EFAULT;
168 return 0; 168 return 0;
169} 169}
170 170
@@ -180,7 +180,7 @@ xfs_bstime_store_compat(
180 sec32 = p->tv_sec; 180 sec32 = p->tv_sec;
181 if (put_user(sec32, &p32->tv_sec) || 181 if (put_user(sec32, &p32->tv_sec) ||
182 put_user(p->tv_nsec, &p32->tv_nsec)) 182 put_user(p->tv_nsec, &p32->tv_nsec))
183 return -XFS_ERROR(EFAULT); 183 return -EFAULT;
184 return 0; 184 return 0;
185} 185}
186 186
@@ -195,7 +195,7 @@ xfs_bulkstat_one_fmt_compat(
195 compat_xfs_bstat_t __user *p32 = ubuffer; 195 compat_xfs_bstat_t __user *p32 = ubuffer;
196 196
197 if (ubsize < sizeof(*p32)) 197 if (ubsize < sizeof(*p32))
198 return XFS_ERROR(ENOMEM); 198 return ENOMEM;
199 199
200 if (put_user(buffer->bs_ino, &p32->bs_ino) || 200 if (put_user(buffer->bs_ino, &p32->bs_ino) ||
201 put_user(buffer->bs_mode, &p32->bs_mode) || 201 put_user(buffer->bs_mode, &p32->bs_mode) ||
@@ -218,7 +218,7 @@ xfs_bulkstat_one_fmt_compat(
218 put_user(buffer->bs_dmevmask, &p32->bs_dmevmask) || 218 put_user(buffer->bs_dmevmask, &p32->bs_dmevmask) ||
219 put_user(buffer->bs_dmstate, &p32->bs_dmstate) || 219 put_user(buffer->bs_dmstate, &p32->bs_dmstate) ||
220 put_user(buffer->bs_aextents, &p32->bs_aextents)) 220 put_user(buffer->bs_aextents, &p32->bs_aextents))
221 return XFS_ERROR(EFAULT); 221 return EFAULT;
222 if (ubused) 222 if (ubused)
223 *ubused = sizeof(*p32); 223 *ubused = sizeof(*p32);
224 return 0; 224 return 0;
@@ -256,30 +256,30 @@ xfs_compat_ioc_bulkstat(
256 /* should be called again (unused here, but used in dmapi) */ 256 /* should be called again (unused here, but used in dmapi) */
257 257
258 if (!capable(CAP_SYS_ADMIN)) 258 if (!capable(CAP_SYS_ADMIN))
259 return -XFS_ERROR(EPERM); 259 return -EPERM;
260 260
261 if (XFS_FORCED_SHUTDOWN(mp)) 261 if (XFS_FORCED_SHUTDOWN(mp))
262 return -XFS_ERROR(EIO); 262 return -EIO;
263 263
264 if (get_user(addr, &p32->lastip)) 264 if (get_user(addr, &p32->lastip))
265 return -XFS_ERROR(EFAULT); 265 return -EFAULT;
266 bulkreq.lastip = compat_ptr(addr); 266 bulkreq.lastip = compat_ptr(addr);
267 if (get_user(bulkreq.icount, &p32->icount) || 267 if (get_user(bulkreq.icount, &p32->icount) ||
268 get_user(addr, &p32->ubuffer)) 268 get_user(addr, &p32->ubuffer))
269 return -XFS_ERROR(EFAULT); 269 return -EFAULT;
270 bulkreq.ubuffer = compat_ptr(addr); 270 bulkreq.ubuffer = compat_ptr(addr);
271 if (get_user(addr, &p32->ocount)) 271 if (get_user(addr, &p32->ocount))
272 return -XFS_ERROR(EFAULT); 272 return -EFAULT;
273 bulkreq.ocount = compat_ptr(addr); 273 bulkreq.ocount = compat_ptr(addr);
274 274
275 if (copy_from_user(&inlast, bulkreq.lastip, sizeof(__s64))) 275 if (copy_from_user(&inlast, bulkreq.lastip, sizeof(__s64)))
276 return -XFS_ERROR(EFAULT); 276 return -EFAULT;
277 277
278 if ((count = bulkreq.icount) <= 0) 278 if ((count = bulkreq.icount) <= 0)
279 return -XFS_ERROR(EINVAL); 279 return -EINVAL;
280 280
281 if (bulkreq.ubuffer == NULL) 281 if (bulkreq.ubuffer == NULL)
282 return -XFS_ERROR(EINVAL); 282 return -EINVAL;
283 283
284 if (cmd == XFS_IOC_FSINUMBERS_32) { 284 if (cmd == XFS_IOC_FSINUMBERS_32) {
285 error = xfs_inumbers(mp, &inlast, &count, 285 error = xfs_inumbers(mp, &inlast, &count,
@@ -294,17 +294,17 @@ xfs_compat_ioc_bulkstat(
294 xfs_bulkstat_one_compat, sizeof(compat_xfs_bstat_t), 294 xfs_bulkstat_one_compat, sizeof(compat_xfs_bstat_t),
295 bulkreq.ubuffer, &done); 295 bulkreq.ubuffer, &done);
296 } else 296 } else
297 error = XFS_ERROR(EINVAL); 297 error = EINVAL;
298 if (error) 298 if (error)
299 return -error; 299 return -error;
300 300
301 if (bulkreq.ocount != NULL) { 301 if (bulkreq.ocount != NULL) {
302 if (copy_to_user(bulkreq.lastip, &inlast, 302 if (copy_to_user(bulkreq.lastip, &inlast,
303 sizeof(xfs_ino_t))) 303 sizeof(xfs_ino_t)))
304 return -XFS_ERROR(EFAULT); 304 return -EFAULT;
305 305
306 if (copy_to_user(bulkreq.ocount, &count, sizeof(count))) 306 if (copy_to_user(bulkreq.ocount, &count, sizeof(count)))
307 return -XFS_ERROR(EFAULT); 307 return -EFAULT;
308 } 308 }
309 309
310 return 0; 310 return 0;
@@ -318,7 +318,7 @@ xfs_compat_handlereq_copyin(
318 compat_xfs_fsop_handlereq_t hreq32; 318 compat_xfs_fsop_handlereq_t hreq32;
319 319
320 if (copy_from_user(&hreq32, arg32, sizeof(compat_xfs_fsop_handlereq_t))) 320 if (copy_from_user(&hreq32, arg32, sizeof(compat_xfs_fsop_handlereq_t)))
321 return -XFS_ERROR(EFAULT); 321 return -EFAULT;
322 322
323 hreq->fd = hreq32.fd; 323 hreq->fd = hreq32.fd;
324 hreq->path = compat_ptr(hreq32.path); 324 hreq->path = compat_ptr(hreq32.path);
@@ -352,19 +352,19 @@ xfs_compat_attrlist_by_handle(
352 char *kbuf; 352 char *kbuf;
353 353
354 if (!capable(CAP_SYS_ADMIN)) 354 if (!capable(CAP_SYS_ADMIN))
355 return -XFS_ERROR(EPERM); 355 return -EPERM;
356 if (copy_from_user(&al_hreq, arg, 356 if (copy_from_user(&al_hreq, arg,
357 sizeof(compat_xfs_fsop_attrlist_handlereq_t))) 357 sizeof(compat_xfs_fsop_attrlist_handlereq_t)))
358 return -XFS_ERROR(EFAULT); 358 return -EFAULT;
359 if (al_hreq.buflen < sizeof(struct attrlist) || 359 if (al_hreq.buflen < sizeof(struct attrlist) ||
360 al_hreq.buflen > XATTR_LIST_MAX) 360 al_hreq.buflen > XATTR_LIST_MAX)
361 return -XFS_ERROR(EINVAL); 361 return -EINVAL;
362 362
363 /* 363 /*
364 * Reject flags, only allow namespaces. 364 * Reject flags, only allow namespaces.
365 */ 365 */
366 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE)) 366 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
367 return -XFS_ERROR(EINVAL); 367 return -EINVAL;
368 368
369 dentry = xfs_compat_handlereq_to_dentry(parfilp, &al_hreq.hreq); 369 dentry = xfs_compat_handlereq_to_dentry(parfilp, &al_hreq.hreq);
370 if (IS_ERR(dentry)) 370 if (IS_ERR(dentry))
@@ -404,10 +404,10 @@ xfs_compat_attrmulti_by_handle(
404 unsigned char *attr_name; 404 unsigned char *attr_name;
405 405
406 if (!capable(CAP_SYS_ADMIN)) 406 if (!capable(CAP_SYS_ADMIN))
407 return -XFS_ERROR(EPERM); 407 return -EPERM;
408 if (copy_from_user(&am_hreq, arg, 408 if (copy_from_user(&am_hreq, arg,
409 sizeof(compat_xfs_fsop_attrmulti_handlereq_t))) 409 sizeof(compat_xfs_fsop_attrmulti_handlereq_t)))
410 return -XFS_ERROR(EFAULT); 410 return -EFAULT;
411 411
412 /* overflow check */ 412 /* overflow check */
413 if (am_hreq.opcount >= INT_MAX / sizeof(compat_xfs_attr_multiop_t)) 413 if (am_hreq.opcount >= INT_MAX / sizeof(compat_xfs_attr_multiop_t))
@@ -475,7 +475,7 @@ xfs_compat_attrmulti_by_handle(
475 } 475 }
476 476
477 if (copy_to_user(compat_ptr(am_hreq.ops), ops, size)) 477 if (copy_to_user(compat_ptr(am_hreq.ops), ops, size))
478 error = XFS_ERROR(EFAULT); 478 error = EFAULT;
479 479
480 kfree(attr_name); 480 kfree(attr_name);
481 out_kfree_ops: 481 out_kfree_ops:
@@ -496,22 +496,22 @@ xfs_compat_fssetdm_by_handle(
496 struct dentry *dentry; 496 struct dentry *dentry;
497 497
498 if (!capable(CAP_MKNOD)) 498 if (!capable(CAP_MKNOD))
499 return -XFS_ERROR(EPERM); 499 return -EPERM;
500 if (copy_from_user(&dmhreq, arg, 500 if (copy_from_user(&dmhreq, arg,
501 sizeof(compat_xfs_fsop_setdm_handlereq_t))) 501 sizeof(compat_xfs_fsop_setdm_handlereq_t)))
502 return -XFS_ERROR(EFAULT); 502 return -EFAULT;
503 503
504 dentry = xfs_compat_handlereq_to_dentry(parfilp, &dmhreq.hreq); 504 dentry = xfs_compat_handlereq_to_dentry(parfilp, &dmhreq.hreq);
505 if (IS_ERR(dentry)) 505 if (IS_ERR(dentry))
506 return PTR_ERR(dentry); 506 return PTR_ERR(dentry);
507 507
508 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) { 508 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) {
509 error = -XFS_ERROR(EPERM); 509 error = -EPERM;
510 goto out; 510 goto out;
511 } 511 }
512 512
513 if (copy_from_user(&fsd, compat_ptr(dmhreq.data), sizeof(fsd))) { 513 if (copy_from_user(&fsd, compat_ptr(dmhreq.data), sizeof(fsd))) {
514 error = -XFS_ERROR(EFAULT); 514 error = -EFAULT;
515 goto out; 515 goto out;
516 } 516 }
517 517
@@ -588,7 +588,7 @@ xfs_file_compat_ioctl(
588 struct xfs_flock64 bf; 588 struct xfs_flock64 bf;
589 589
590 if (xfs_compat_flock64_copyin(&bf, arg)) 590 if (xfs_compat_flock64_copyin(&bf, arg))
591 return -XFS_ERROR(EFAULT); 591 return -EFAULT;
592 cmd = _NATIVE_IOC(cmd, struct xfs_flock64); 592 cmd = _NATIVE_IOC(cmd, struct xfs_flock64);
593 return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf); 593 return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf);
594 } 594 }
@@ -598,7 +598,7 @@ xfs_file_compat_ioctl(
598 struct xfs_growfs_data in; 598 struct xfs_growfs_data in;
599 599
600 if (xfs_compat_growfs_data_copyin(&in, arg)) 600 if (xfs_compat_growfs_data_copyin(&in, arg))
601 return -XFS_ERROR(EFAULT); 601 return -EFAULT;
602 error = mnt_want_write_file(filp); 602 error = mnt_want_write_file(filp);
603 if (error) 603 if (error)
604 return error; 604 return error;
@@ -610,7 +610,7 @@ xfs_file_compat_ioctl(
610 struct xfs_growfs_rt in; 610 struct xfs_growfs_rt in;
611 611
612 if (xfs_compat_growfs_rt_copyin(&in, arg)) 612 if (xfs_compat_growfs_rt_copyin(&in, arg))
613 return -XFS_ERROR(EFAULT); 613 return -EFAULT;
614 error = mnt_want_write_file(filp); 614 error = mnt_want_write_file(filp);
615 if (error) 615 if (error)
616 return error; 616 return error;
@@ -633,7 +633,7 @@ xfs_file_compat_ioctl(
633 if (copy_from_user(&sxp, sxu, 633 if (copy_from_user(&sxp, sxu,
634 offsetof(struct xfs_swapext, sx_stat)) || 634 offsetof(struct xfs_swapext, sx_stat)) ||
635 xfs_ioctl32_bstat_copyin(&sxp.sx_stat, &sxu->sx_stat)) 635 xfs_ioctl32_bstat_copyin(&sxp.sx_stat, &sxu->sx_stat))
636 return -XFS_ERROR(EFAULT); 636 return -EFAULT;
637 error = mnt_want_write_file(filp); 637 error = mnt_want_write_file(filp);
638 if (error) 638 if (error)
639 return error; 639 return error;
@@ -651,7 +651,7 @@ xfs_file_compat_ioctl(
651 struct xfs_fsop_handlereq hreq; 651 struct xfs_fsop_handlereq hreq;
652 652
653 if (xfs_compat_handlereq_copyin(&hreq, arg)) 653 if (xfs_compat_handlereq_copyin(&hreq, arg))
654 return -XFS_ERROR(EFAULT); 654 return -EFAULT;
655 cmd = _NATIVE_IOC(cmd, struct xfs_fsop_handlereq); 655 cmd = _NATIVE_IOC(cmd, struct xfs_fsop_handlereq);
656 return xfs_find_handle(cmd, &hreq); 656 return xfs_find_handle(cmd, &hreq);
657 } 657 }
@@ -659,14 +659,14 @@ xfs_file_compat_ioctl(
659 struct xfs_fsop_handlereq hreq; 659 struct xfs_fsop_handlereq hreq;
660 660
661 if (xfs_compat_handlereq_copyin(&hreq, arg)) 661 if (xfs_compat_handlereq_copyin(&hreq, arg))
662 return -XFS_ERROR(EFAULT); 662 return -EFAULT;
663 return xfs_open_by_handle(filp, &hreq); 663 return xfs_open_by_handle(filp, &hreq);
664 } 664 }
665 case XFS_IOC_READLINK_BY_HANDLE_32: { 665 case XFS_IOC_READLINK_BY_HANDLE_32: {
666 struct xfs_fsop_handlereq hreq; 666 struct xfs_fsop_handlereq hreq;
667 667
668 if (xfs_compat_handlereq_copyin(&hreq, arg)) 668 if (xfs_compat_handlereq_copyin(&hreq, arg))
669 return -XFS_ERROR(EFAULT); 669 return -EFAULT;
670 return xfs_readlink_by_handle(filp, &hreq); 670 return xfs_readlink_by_handle(filp, &hreq);
671 } 671 }
672 case XFS_IOC_ATTRLIST_BY_HANDLE_32: 672 case XFS_IOC_ATTRLIST_BY_HANDLE_32:
@@ -676,6 +676,6 @@ xfs_file_compat_ioctl(
676 case XFS_IOC_FSSETDM_BY_HANDLE_32: 676 case XFS_IOC_FSSETDM_BY_HANDLE_32:
677 return xfs_compat_fssetdm_by_handle(filp, arg); 677 return xfs_compat_fssetdm_by_handle(filp, arg);
678 default: 678 default:
679 return -XFS_ERROR(ENOIOCTLCMD); 679 return -ENOIOCTLCMD;
680 } 680 }
681} 681}
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 6c5eb4c551e3..c6d603080e5b 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -138,7 +138,7 @@ xfs_iomap_write_direct(
138 138
139 error = xfs_qm_dqattach(ip, 0); 139 error = xfs_qm_dqattach(ip, 0);
140 if (error) 140 if (error)
141 return XFS_ERROR(error); 141 return error;
142 142
143 rt = XFS_IS_REALTIME_INODE(ip); 143 rt = XFS_IS_REALTIME_INODE(ip);
144 extsz = xfs_get_extsz_hint(ip); 144 extsz = xfs_get_extsz_hint(ip);
@@ -148,7 +148,7 @@ xfs_iomap_write_direct(
148 if ((offset + count) > XFS_ISIZE(ip)) { 148 if ((offset + count) > XFS_ISIZE(ip)) {
149 error = xfs_iomap_eof_align_last_fsb(mp, ip, extsz, &last_fsb); 149 error = xfs_iomap_eof_align_last_fsb(mp, ip, extsz, &last_fsb);
150 if (error) 150 if (error)
151 return XFS_ERROR(error); 151 return error;
152 } else { 152 } else {
153 if (nmaps && (imap->br_startblock == HOLESTARTBLOCK)) 153 if (nmaps && (imap->br_startblock == HOLESTARTBLOCK))
154 last_fsb = MIN(last_fsb, (xfs_fileoff_t) 154 last_fsb = MIN(last_fsb, (xfs_fileoff_t)
@@ -188,7 +188,7 @@ xfs_iomap_write_direct(
188 */ 188 */
189 if (error) { 189 if (error) {
190 xfs_trans_cancel(tp, 0); 190 xfs_trans_cancel(tp, 0);
191 return XFS_ERROR(error); 191 return error;
192 } 192 }
193 193
194 xfs_ilock(ip, XFS_ILOCK_EXCL); 194 xfs_ilock(ip, XFS_ILOCK_EXCL);
@@ -225,7 +225,7 @@ xfs_iomap_write_direct(
225 * Copy any maps to caller's array and return any error. 225 * Copy any maps to caller's array and return any error.
226 */ 226 */
227 if (nimaps == 0) { 227 if (nimaps == 0) {
228 error = XFS_ERROR(ENOSPC); 228 error = ENOSPC;
229 goto out_unlock; 229 goto out_unlock;
230 } 230 }
231 231
@@ -552,7 +552,7 @@ xfs_iomap_write_delay(
552 */ 552 */
553 error = xfs_qm_dqattach_locked(ip, 0); 553 error = xfs_qm_dqattach_locked(ip, 0);
554 if (error) 554 if (error)
555 return XFS_ERROR(error); 555 return error;
556 556
557 extsz = xfs_get_extsz_hint(ip); 557 extsz = xfs_get_extsz_hint(ip);
558 offset_fsb = XFS_B_TO_FSBT(mp, offset); 558 offset_fsb = XFS_B_TO_FSBT(mp, offset);
@@ -600,7 +600,7 @@ retry:
600 case EDQUOT: 600 case EDQUOT:
601 break; 601 break;
602 default: 602 default:
603 return XFS_ERROR(error); 603 return error;
604 } 604 }
605 605
606 /* 606 /*
@@ -614,7 +614,7 @@ retry:
614 error = 0; 614 error = 0;
615 goto retry; 615 goto retry;
616 } 616 }
617 return XFS_ERROR(error ? error : ENOSPC); 617 return error ? error : ENOSPC;
618 } 618 }
619 619
620 if (!(imap[0].br_startblock || XFS_IS_REALTIME_INODE(ip))) 620 if (!(imap[0].br_startblock || XFS_IS_REALTIME_INODE(ip)))
@@ -663,7 +663,7 @@ xfs_iomap_write_allocate(
663 */ 663 */
664 error = xfs_qm_dqattach(ip, 0); 664 error = xfs_qm_dqattach(ip, 0);
665 if (error) 665 if (error)
666 return XFS_ERROR(error); 666 return error;
667 667
668 offset_fsb = XFS_B_TO_FSBT(mp, offset); 668 offset_fsb = XFS_B_TO_FSBT(mp, offset);
669 count_fsb = imap->br_blockcount; 669 count_fsb = imap->br_blockcount;
@@ -690,7 +690,7 @@ xfs_iomap_write_allocate(
690 nres, 0); 690 nres, 0);
691 if (error) { 691 if (error) {
692 xfs_trans_cancel(tp, 0); 692 xfs_trans_cancel(tp, 0);
693 return XFS_ERROR(error); 693 return error;
694 } 694 }
695 xfs_ilock(ip, XFS_ILOCK_EXCL); 695 xfs_ilock(ip, XFS_ILOCK_EXCL);
696 xfs_trans_ijoin(tp, ip, 0); 696 xfs_trans_ijoin(tp, ip, 0);
@@ -794,7 +794,7 @@ trans_cancel:
794 xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); 794 xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT);
795error0: 795error0:
796 xfs_iunlock(ip, XFS_ILOCK_EXCL); 796 xfs_iunlock(ip, XFS_ILOCK_EXCL);
797 return XFS_ERROR(error); 797 return error;
798} 798}
799 799
800int 800int
@@ -854,7 +854,7 @@ xfs_iomap_write_unwritten(
854 resblks, 0); 854 resblks, 0);
855 if (error) { 855 if (error) {
856 xfs_trans_cancel(tp, 0); 856 xfs_trans_cancel(tp, 0);
857 return XFS_ERROR(error); 857 return error;
858 } 858 }
859 859
860 xfs_ilock(ip, XFS_ILOCK_EXCL); 860 xfs_ilock(ip, XFS_ILOCK_EXCL);
@@ -893,7 +893,7 @@ xfs_iomap_write_unwritten(
893 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); 893 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
894 xfs_iunlock(ip, XFS_ILOCK_EXCL); 894 xfs_iunlock(ip, XFS_ILOCK_EXCL);
895 if (error) 895 if (error)
896 return XFS_ERROR(error); 896 return error;
897 897
898 if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip))) 898 if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip)))
899 return xfs_alert_fsblock_zero(ip, &imap); 899 return xfs_alert_fsblock_zero(ip, &imap);
@@ -916,5 +916,5 @@ error_on_bmapi_transaction:
916 xfs_bmap_cancel(&free_list); 916 xfs_bmap_cancel(&free_list);
917 xfs_trans_cancel(tp, (XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT)); 917 xfs_trans_cancel(tp, (XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT));
918 xfs_iunlock(ip, XFS_ILOCK_EXCL); 918 xfs_iunlock(ip, XFS_ILOCK_EXCL);
919 return XFS_ERROR(error); 919 return error;
920} 920}
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 205613a06068..6bdc1fc8f950 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -441,7 +441,7 @@ xfs_vn_getattr(
441 trace_xfs_getattr(ip); 441 trace_xfs_getattr(ip);
442 442
443 if (XFS_FORCED_SHUTDOWN(mp)) 443 if (XFS_FORCED_SHUTDOWN(mp))
444 return -XFS_ERROR(EIO); 444 return -EIO;
445 445
446 stat->size = XFS_ISIZE(ip); 446 stat->size = XFS_ISIZE(ip);
447 stat->dev = inode->i_sb->s_dev; 447 stat->dev = inode->i_sb->s_dev;
@@ -546,14 +546,14 @@ xfs_setattr_nonsize(
546 /* If acls are being inherited, we already have this checked */ 546 /* If acls are being inherited, we already have this checked */
547 if (!(flags & XFS_ATTR_NOACL)) { 547 if (!(flags & XFS_ATTR_NOACL)) {
548 if (mp->m_flags & XFS_MOUNT_RDONLY) 548 if (mp->m_flags & XFS_MOUNT_RDONLY)
549 return XFS_ERROR(EROFS); 549 return EROFS;
550 550
551 if (XFS_FORCED_SHUTDOWN(mp)) 551 if (XFS_FORCED_SHUTDOWN(mp))
552 return XFS_ERROR(EIO); 552 return EIO;
553 553
554 error = -inode_change_ok(inode, iattr); 554 error = -inode_change_ok(inode, iattr);
555 if (error) 555 if (error)
556 return XFS_ERROR(error); 556 return error;
557 } 557 }
558 558
559 ASSERT((mask & ATTR_SIZE) == 0); 559 ASSERT((mask & ATTR_SIZE) == 0);
@@ -703,7 +703,7 @@ xfs_setattr_nonsize(
703 xfs_qm_dqrele(gdqp); 703 xfs_qm_dqrele(gdqp);
704 704
705 if (error) 705 if (error)
706 return XFS_ERROR(error); 706 return error;
707 707
708 /* 708 /*
709 * XXX(hch): Updating the ACL entries is not atomic vs the i_mode 709 * XXX(hch): Updating the ACL entries is not atomic vs the i_mode
@@ -715,7 +715,7 @@ xfs_setattr_nonsize(
715 if ((mask & ATTR_MODE) && !(flags & XFS_ATTR_NOACL)) { 715 if ((mask & ATTR_MODE) && !(flags & XFS_ATTR_NOACL)) {
716 error = -posix_acl_chmod(inode, inode->i_mode); 716 error = -posix_acl_chmod(inode, inode->i_mode);
717 if (error) 717 if (error)
718 return XFS_ERROR(error); 718 return error;
719 } 719 }
720 720
721 return 0; 721 return 0;
@@ -748,14 +748,14 @@ xfs_setattr_size(
748 trace_xfs_setattr(ip); 748 trace_xfs_setattr(ip);
749 749
750 if (mp->m_flags & XFS_MOUNT_RDONLY) 750 if (mp->m_flags & XFS_MOUNT_RDONLY)
751 return XFS_ERROR(EROFS); 751 return EROFS;
752 752
753 if (XFS_FORCED_SHUTDOWN(mp)) 753 if (XFS_FORCED_SHUTDOWN(mp))
754 return XFS_ERROR(EIO); 754 return EIO;
755 755
756 error = -inode_change_ok(inode, iattr); 756 error = -inode_change_ok(inode, iattr);
757 if (error) 757 if (error)
758 return XFS_ERROR(error); 758 return error;
759 759
760 ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); 760 ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));
761 ASSERT(S_ISREG(ip->i_d.di_mode)); 761 ASSERT(S_ISREG(ip->i_d.di_mode));
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index cb64f222d607..e4056a7495e5 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -67,11 +67,11 @@ xfs_bulkstat_one_int(
67 *stat = BULKSTAT_RV_NOTHING; 67 *stat = BULKSTAT_RV_NOTHING;
68 68
69 if (!buffer || xfs_internal_inum(mp, ino)) 69 if (!buffer || xfs_internal_inum(mp, ino))
70 return XFS_ERROR(EINVAL); 70 return EINVAL;
71 71
72 buf = kmem_alloc(sizeof(*buf), KM_SLEEP | KM_MAYFAIL); 72 buf = kmem_alloc(sizeof(*buf), KM_SLEEP | KM_MAYFAIL);
73 if (!buf) 73 if (!buf)
74 return XFS_ERROR(ENOMEM); 74 return ENOMEM;
75 75
76 error = xfs_iget(mp, NULL, ino, 76 error = xfs_iget(mp, NULL, ino,
77 (XFS_IGET_DONTCACHE | XFS_IGET_UNTRUSTED), 77 (XFS_IGET_DONTCACHE | XFS_IGET_UNTRUSTED),
@@ -154,9 +154,9 @@ xfs_bulkstat_one_fmt(
154 const xfs_bstat_t *buffer) 154 const xfs_bstat_t *buffer)
155{ 155{
156 if (ubsize < sizeof(*buffer)) 156 if (ubsize < sizeof(*buffer))
157 return XFS_ERROR(ENOMEM); 157 return ENOMEM;
158 if (copy_to_user(ubuffer, buffer, sizeof(*buffer))) 158 if (copy_to_user(ubuffer, buffer, sizeof(*buffer)))
159 return XFS_ERROR(EFAULT); 159 return EFAULT;
160 if (ubused) 160 if (ubused)
161 *ubused = sizeof(*buffer); 161 *ubused = sizeof(*buffer);
162 return 0; 162 return 0;
@@ -552,7 +552,7 @@ xfs_bulkstat_single(
552 return error; 552 return error;
553 if (count == 0 || (xfs_ino_t)*lastinop != ino) 553 if (count == 0 || (xfs_ino_t)*lastinop != ino)
554 return error == EFSCORRUPTED ? 554 return error == EFSCORRUPTED ?
555 XFS_ERROR(EINVAL) : error; 555 EINVAL : error;
556 else 556 else
557 return 0; 557 return 0;
558 } 558 }
@@ -661,7 +661,7 @@ xfs_inumbers(
661 if (bufidx == bcount) { 661 if (bufidx == bcount) {
662 long written; 662 long written;
663 if (formatter(ubuffer, buffer, bufidx, &written)) { 663 if (formatter(ubuffer, buffer, bufidx, &written)) {
664 error = XFS_ERROR(EFAULT); 664 error = EFAULT;
665 break; 665 break;
666 } 666 }
667 ubuffer += written; 667 ubuffer += written;
@@ -688,7 +688,7 @@ xfs_inumbers(
688 if (bufidx) { 688 if (bufidx) {
689 long written; 689 long written;
690 if (formatter(ubuffer, buffer, bufidx, &written)) 690 if (formatter(ubuffer, buffer, bufidx, &written))
691 error = XFS_ERROR(EFAULT); 691 error = EFAULT;
692 else 692 else
693 *count += bufidx; 693 *count += bufidx;
694 } 694 }
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 292308dede6d..01b715677596 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -283,7 +283,7 @@ xlog_grant_head_wait(
283 return 0; 283 return 0;
284shutdown: 284shutdown:
285 list_del_init(&tic->t_queue); 285 list_del_init(&tic->t_queue);
286 return XFS_ERROR(EIO); 286 return EIO;
287} 287}
288 288
289/* 289/*
@@ -377,7 +377,7 @@ xfs_log_regrant(
377 int error = 0; 377 int error = 0;
378 378
379 if (XLOG_FORCED_SHUTDOWN(log)) 379 if (XLOG_FORCED_SHUTDOWN(log))
380 return XFS_ERROR(EIO); 380 return EIO;
381 381
382 XFS_STATS_INC(xs_try_logspace); 382 XFS_STATS_INC(xs_try_logspace);
383 383
@@ -446,7 +446,7 @@ xfs_log_reserve(
446 ASSERT(client == XFS_TRANSACTION || client == XFS_LOG); 446 ASSERT(client == XFS_TRANSACTION || client == XFS_LOG);
447 447
448 if (XLOG_FORCED_SHUTDOWN(log)) 448 if (XLOG_FORCED_SHUTDOWN(log))
449 return XFS_ERROR(EIO); 449 return EIO;
450 450
451 XFS_STATS_INC(xs_try_logspace); 451 XFS_STATS_INC(xs_try_logspace);
452 452
@@ -454,7 +454,7 @@ xfs_log_reserve(
454 tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent, 454 tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent,
455 KM_SLEEP | KM_MAYFAIL); 455 KM_SLEEP | KM_MAYFAIL);
456 if (!tic) 456 if (!tic)
457 return XFS_ERROR(ENOMEM); 457 return ENOMEM;
458 458
459 tic->t_trans_type = t_type; 459 tic->t_trans_type = t_type;
460 *ticp = tic; 460 *ticp = tic;
@@ -2360,7 +2360,7 @@ xlog_write(
2360 2360
2361 ophdr = xlog_write_setup_ophdr(log, ptr, ticket, flags); 2361 ophdr = xlog_write_setup_ophdr(log, ptr, ticket, flags);
2362 if (!ophdr) 2362 if (!ophdr)
2363 return XFS_ERROR(EIO); 2363 return EIO;
2364 2364
2365 xlog_write_adv_cnt(&ptr, &len, &log_offset, 2365 xlog_write_adv_cnt(&ptr, &len, &log_offset,
2366 sizeof(struct xlog_op_header)); 2366 sizeof(struct xlog_op_header));
@@ -2859,7 +2859,7 @@ restart:
2859 spin_lock(&log->l_icloglock); 2859 spin_lock(&log->l_icloglock);
2860 if (XLOG_FORCED_SHUTDOWN(log)) { 2860 if (XLOG_FORCED_SHUTDOWN(log)) {
2861 spin_unlock(&log->l_icloglock); 2861 spin_unlock(&log->l_icloglock);
2862 return XFS_ERROR(EIO); 2862 return EIO;
2863 } 2863 }
2864 2864
2865 iclog = log->l_iclog; 2865 iclog = log->l_iclog;
@@ -3047,7 +3047,7 @@ xlog_state_release_iclog(
3047 int sync = 0; /* do we sync? */ 3047 int sync = 0; /* do we sync? */
3048 3048
3049 if (iclog->ic_state & XLOG_STATE_IOERROR) 3049 if (iclog->ic_state & XLOG_STATE_IOERROR)
3050 return XFS_ERROR(EIO); 3050 return EIO;
3051 3051
3052 ASSERT(atomic_read(&iclog->ic_refcnt) > 0); 3052 ASSERT(atomic_read(&iclog->ic_refcnt) > 0);
3053 if (!atomic_dec_and_lock(&iclog->ic_refcnt, &log->l_icloglock)) 3053 if (!atomic_dec_and_lock(&iclog->ic_refcnt, &log->l_icloglock))
@@ -3055,7 +3055,7 @@ xlog_state_release_iclog(
3055 3055
3056 if (iclog->ic_state & XLOG_STATE_IOERROR) { 3056 if (iclog->ic_state & XLOG_STATE_IOERROR) {
3057 spin_unlock(&log->l_icloglock); 3057 spin_unlock(&log->l_icloglock);
3058 return XFS_ERROR(EIO); 3058 return EIO;
3059 } 3059 }
3060 ASSERT(iclog->ic_state == XLOG_STATE_ACTIVE || 3060 ASSERT(iclog->ic_state == XLOG_STATE_ACTIVE ||
3061 iclog->ic_state == XLOG_STATE_WANT_SYNC); 3061 iclog->ic_state == XLOG_STATE_WANT_SYNC);
@@ -3172,7 +3172,7 @@ _xfs_log_force(
3172 iclog = log->l_iclog; 3172 iclog = log->l_iclog;
3173 if (iclog->ic_state & XLOG_STATE_IOERROR) { 3173 if (iclog->ic_state & XLOG_STATE_IOERROR) {
3174 spin_unlock(&log->l_icloglock); 3174 spin_unlock(&log->l_icloglock);
3175 return XFS_ERROR(EIO); 3175 return EIO;
3176 } 3176 }
3177 3177
3178 /* If the head iclog is not active nor dirty, we just attach 3178 /* If the head iclog is not active nor dirty, we just attach
@@ -3210,7 +3210,7 @@ _xfs_log_force(
3210 spin_unlock(&log->l_icloglock); 3210 spin_unlock(&log->l_icloglock);
3211 3211
3212 if (xlog_state_release_iclog(log, iclog)) 3212 if (xlog_state_release_iclog(log, iclog))
3213 return XFS_ERROR(EIO); 3213 return EIO;
3214 3214
3215 if (log_flushed) 3215 if (log_flushed)
3216 *log_flushed = 1; 3216 *log_flushed = 1;
@@ -3246,7 +3246,7 @@ maybe_sleep:
3246 */ 3246 */
3247 if (iclog->ic_state & XLOG_STATE_IOERROR) { 3247 if (iclog->ic_state & XLOG_STATE_IOERROR) {
3248 spin_unlock(&log->l_icloglock); 3248 spin_unlock(&log->l_icloglock);
3249 return XFS_ERROR(EIO); 3249 return EIO;
3250 } 3250 }
3251 XFS_STATS_INC(xs_log_force_sleep); 3251 XFS_STATS_INC(xs_log_force_sleep);
3252 xlog_wait(&iclog->ic_force_wait, &log->l_icloglock); 3252 xlog_wait(&iclog->ic_force_wait, &log->l_icloglock);
@@ -3256,7 +3256,7 @@ maybe_sleep:
3256 * and the memory read should be atomic. 3256 * and the memory read should be atomic.
3257 */ 3257 */
3258 if (iclog->ic_state & XLOG_STATE_IOERROR) 3258 if (iclog->ic_state & XLOG_STATE_IOERROR)
3259 return XFS_ERROR(EIO); 3259 return EIO;
3260 if (log_flushed) 3260 if (log_flushed)
3261 *log_flushed = 1; 3261 *log_flushed = 1;
3262 } else { 3262 } else {
@@ -3324,7 +3324,7 @@ try_again:
3324 iclog = log->l_iclog; 3324 iclog = log->l_iclog;
3325 if (iclog->ic_state & XLOG_STATE_IOERROR) { 3325 if (iclog->ic_state & XLOG_STATE_IOERROR) {
3326 spin_unlock(&log->l_icloglock); 3326 spin_unlock(&log->l_icloglock);
3327 return XFS_ERROR(EIO); 3327 return EIO;
3328 } 3328 }
3329 3329
3330 do { 3330 do {
@@ -3375,7 +3375,7 @@ try_again:
3375 xlog_state_switch_iclogs(log, iclog, 0); 3375 xlog_state_switch_iclogs(log, iclog, 0);
3376 spin_unlock(&log->l_icloglock); 3376 spin_unlock(&log->l_icloglock);
3377 if (xlog_state_release_iclog(log, iclog)) 3377 if (xlog_state_release_iclog(log, iclog))
3378 return XFS_ERROR(EIO); 3378 return EIO;
3379 if (log_flushed) 3379 if (log_flushed)
3380 *log_flushed = 1; 3380 *log_flushed = 1;
3381 spin_lock(&log->l_icloglock); 3381 spin_lock(&log->l_icloglock);
@@ -3390,7 +3390,7 @@ try_again:
3390 */ 3390 */
3391 if (iclog->ic_state & XLOG_STATE_IOERROR) { 3391 if (iclog->ic_state & XLOG_STATE_IOERROR) {
3392 spin_unlock(&log->l_icloglock); 3392 spin_unlock(&log->l_icloglock);
3393 return XFS_ERROR(EIO); 3393 return EIO;
3394 } 3394 }
3395 XFS_STATS_INC(xs_log_force_sleep); 3395 XFS_STATS_INC(xs_log_force_sleep);
3396 xlog_wait(&iclog->ic_force_wait, &log->l_icloglock); 3396 xlog_wait(&iclog->ic_force_wait, &log->l_icloglock);
@@ -3400,7 +3400,7 @@ try_again:
3400 * and the memory read should be atomic. 3400 * and the memory read should be atomic.
3401 */ 3401 */
3402 if (iclog->ic_state & XLOG_STATE_IOERROR) 3402 if (iclog->ic_state & XLOG_STATE_IOERROR)
3403 return XFS_ERROR(EIO); 3403 return EIO;
3404 3404
3405 if (log_flushed) 3405 if (log_flushed)
3406 *log_flushed = 1; 3406 *log_flushed = 1;
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index b3425b34e3d5..0d554f2cb4a8 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -634,7 +634,7 @@ out_abort_free_ticket:
634 xfs_log_ticket_put(tic); 634 xfs_log_ticket_put(tic);
635out_abort: 635out_abort:
636 xlog_cil_committed(ctx, XFS_LI_ABORTED); 636 xlog_cil_committed(ctx, XFS_LI_ABORTED);
637 return XFS_ERROR(EIO); 637 return EIO;
638} 638}
639 639
640static void 640static void
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 4c60f118595b..845a92c9c241 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -194,7 +194,7 @@ xlog_bread_noalign(
194 bp->b_error = 0; 194 bp->b_error = 0;
195 195
196 if (XFS_FORCED_SHUTDOWN(log->l_mp)) 196 if (XFS_FORCED_SHUTDOWN(log->l_mp))
197 return XFS_ERROR(EIO); 197 return EIO;
198 198
199 xfs_buf_iorequest(bp); 199 xfs_buf_iorequest(bp);
200 error = xfs_buf_iowait(bp); 200 error = xfs_buf_iowait(bp);
@@ -330,14 +330,14 @@ xlog_header_check_recover(
330 xlog_header_check_dump(mp, head); 330 xlog_header_check_dump(mp, head);
331 XFS_ERROR_REPORT("xlog_header_check_recover(1)", 331 XFS_ERROR_REPORT("xlog_header_check_recover(1)",
332 XFS_ERRLEVEL_HIGH, mp); 332 XFS_ERRLEVEL_HIGH, mp);
333 return XFS_ERROR(EFSCORRUPTED); 333 return EFSCORRUPTED;
334 } else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) { 334 } else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
335 xfs_warn(mp, 335 xfs_warn(mp,
336 "dirty log entry has mismatched uuid - can't recover"); 336 "dirty log entry has mismatched uuid - can't recover");
337 xlog_header_check_dump(mp, head); 337 xlog_header_check_dump(mp, head);
338 XFS_ERROR_REPORT("xlog_header_check_recover(2)", 338 XFS_ERROR_REPORT("xlog_header_check_recover(2)",
339 XFS_ERRLEVEL_HIGH, mp); 339 XFS_ERRLEVEL_HIGH, mp);
340 return XFS_ERROR(EFSCORRUPTED); 340 return EFSCORRUPTED;
341 } 341 }
342 return 0; 342 return 0;
343} 343}
@@ -364,7 +364,7 @@ xlog_header_check_mount(
364 xlog_header_check_dump(mp, head); 364 xlog_header_check_dump(mp, head);
365 XFS_ERROR_REPORT("xlog_header_check_mount", 365 XFS_ERROR_REPORT("xlog_header_check_mount",
366 XFS_ERRLEVEL_HIGH, mp); 366 XFS_ERRLEVEL_HIGH, mp);
367 return XFS_ERROR(EFSCORRUPTED); 367 return EFSCORRUPTED;
368 } 368 }
369 return 0; 369 return 0;
370} 370}
@@ -539,7 +539,7 @@ xlog_find_verify_log_record(
539 xfs_warn(log->l_mp, 539 xfs_warn(log->l_mp,
540 "Log inconsistent (didn't find previous header)"); 540 "Log inconsistent (didn't find previous header)");
541 ASSERT(0); 541 ASSERT(0);
542 error = XFS_ERROR(EIO); 542 error = EIO;
543 goto out; 543 goto out;
544 } 544 }
545 545
@@ -820,7 +820,7 @@ validate_head:
820 /* start ptr at last block ptr before head_blk */ 820 /* start ptr at last block ptr before head_blk */
821 if ((error = xlog_find_verify_log_record(log, start_blk, 821 if ((error = xlog_find_verify_log_record(log, start_blk,
822 &head_blk, 0)) == -1) { 822 &head_blk, 0)) == -1) {
823 error = XFS_ERROR(EIO); 823 error = EIO;
824 goto bp_err; 824 goto bp_err;
825 } else if (error) 825 } else if (error)
826 goto bp_err; 826 goto bp_err;
@@ -838,7 +838,7 @@ validate_head:
838 if ((error = xlog_find_verify_log_record(log, 838 if ((error = xlog_find_verify_log_record(log,
839 start_blk, &new_blk, 839 start_blk, &new_blk,
840 (int)head_blk)) == -1) { 840 (int)head_blk)) == -1) {
841 error = XFS_ERROR(EIO); 841 error = EIO;
842 goto bp_err; 842 goto bp_err;
843 } else if (error) 843 } else if (error)
844 goto bp_err; 844 goto bp_err;
@@ -961,7 +961,7 @@ xlog_find_tail(
961 xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__); 961 xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__);
962 xlog_put_bp(bp); 962 xlog_put_bp(bp);
963 ASSERT(0); 963 ASSERT(0);
964 return XFS_ERROR(EIO); 964 return EIO;
965 } 965 }
966 966
967 /* find blk_no of tail of log */ 967 /* find blk_no of tail of log */
@@ -1141,7 +1141,7 @@ xlog_find_zeroed(
1141 */ 1141 */
1142 xfs_warn(log->l_mp, 1142 xfs_warn(log->l_mp,
1143 "Log inconsistent or not a log (last==0, first!=1)"); 1143 "Log inconsistent or not a log (last==0, first!=1)");
1144 error = XFS_ERROR(EINVAL); 1144 error = EINVAL;
1145 goto bp_err; 1145 goto bp_err;
1146 } 1146 }
1147 1147
@@ -1181,7 +1181,7 @@ xlog_find_zeroed(
1181 */ 1181 */
1182 if ((error = xlog_find_verify_log_record(log, start_blk, 1182 if ((error = xlog_find_verify_log_record(log, start_blk,
1183 &last_blk, 0)) == -1) { 1183 &last_blk, 0)) == -1) {
1184 error = XFS_ERROR(EIO); 1184 error = EIO;
1185 goto bp_err; 1185 goto bp_err;
1186 } else if (error) 1186 } else if (error)
1187 goto bp_err; 1187 goto bp_err;
@@ -1354,7 +1354,7 @@ xlog_clear_stale_blocks(
1354 if (unlikely(head_block < tail_block || head_block >= log->l_logBBsize)) { 1354 if (unlikely(head_block < tail_block || head_block >= log->l_logBBsize)) {
1355 XFS_ERROR_REPORT("xlog_clear_stale_blocks(1)", 1355 XFS_ERROR_REPORT("xlog_clear_stale_blocks(1)",
1356 XFS_ERRLEVEL_LOW, log->l_mp); 1356 XFS_ERRLEVEL_LOW, log->l_mp);
1357 return XFS_ERROR(EFSCORRUPTED); 1357 return EFSCORRUPTED;
1358 } 1358 }
1359 tail_distance = tail_block + (log->l_logBBsize - head_block); 1359 tail_distance = tail_block + (log->l_logBBsize - head_block);
1360 } else { 1360 } else {
@@ -1366,7 +1366,7 @@ xlog_clear_stale_blocks(
1366 if (unlikely(head_block >= tail_block || head_cycle != (tail_cycle + 1))){ 1366 if (unlikely(head_block >= tail_block || head_cycle != (tail_cycle + 1))){
1367 XFS_ERROR_REPORT("xlog_clear_stale_blocks(2)", 1367 XFS_ERROR_REPORT("xlog_clear_stale_blocks(2)",
1368 XFS_ERRLEVEL_LOW, log->l_mp); 1368 XFS_ERRLEVEL_LOW, log->l_mp);
1369 return XFS_ERROR(EFSCORRUPTED); 1369 return EFSCORRUPTED;
1370 } 1370 }
1371 tail_distance = tail_block - head_block; 1371 tail_distance = tail_block - head_block;
1372 } 1372 }
@@ -1551,7 +1551,7 @@ xlog_recover_add_to_trans(
1551 xfs_warn(log->l_mp, "%s: bad header magic number", 1551 xfs_warn(log->l_mp, "%s: bad header magic number",
1552 __func__); 1552 __func__);
1553 ASSERT(0); 1553 ASSERT(0);
1554 return XFS_ERROR(EIO); 1554 return EIO;
1555 } 1555 }
1556 if (len == sizeof(xfs_trans_header_t)) 1556 if (len == sizeof(xfs_trans_header_t))
1557 xlog_recover_add_item(&trans->r_itemq); 1557 xlog_recover_add_item(&trans->r_itemq);
@@ -1581,7 +1581,7 @@ xlog_recover_add_to_trans(
1581 in_f->ilf_size); 1581 in_f->ilf_size);
1582 ASSERT(0); 1582 ASSERT(0);
1583 kmem_free(ptr); 1583 kmem_free(ptr);
1584 return XFS_ERROR(EIO); 1584 return EIO;
1585 } 1585 }
1586 1586
1587 item->ri_total = in_f->ilf_size; 1587 item->ri_total = in_f->ilf_size;
@@ -1702,7 +1702,7 @@ xlog_recover_reorder_trans(
1702 */ 1702 */
1703 if (!list_empty(&sort_list)) 1703 if (!list_empty(&sort_list))
1704 list_splice_init(&sort_list, &trans->r_itemq); 1704 list_splice_init(&sort_list, &trans->r_itemq);
1705 error = XFS_ERROR(EIO); 1705 error = EIO;
1706 goto out; 1706 goto out;
1707 } 1707 }
1708 } 1708 }
@@ -1943,7 +1943,7 @@ xlog_recover_do_inode_buffer(
1943 item, bp); 1943 item, bp);
1944 XFS_ERROR_REPORT("xlog_recover_do_inode_buf", 1944 XFS_ERROR_REPORT("xlog_recover_do_inode_buf",
1945 XFS_ERRLEVEL_LOW, mp); 1945 XFS_ERRLEVEL_LOW, mp);
1946 return XFS_ERROR(EFSCORRUPTED); 1946 return EFSCORRUPTED;
1947 } 1947 }
1948 1948
1949 buffer_nextp = (xfs_agino_t *)xfs_buf_offset(bp, 1949 buffer_nextp = (xfs_agino_t *)xfs_buf_offset(bp,
@@ -2496,7 +2496,7 @@ xlog_recover_buffer_pass2(
2496 bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len, 2496 bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len,
2497 buf_flags, NULL); 2497 buf_flags, NULL);
2498 if (!bp) 2498 if (!bp)
2499 return XFS_ERROR(ENOMEM); 2499 return ENOMEM;
2500 error = bp->b_error; 2500 error = bp->b_error;
2501 if (error) { 2501 if (error) {
2502 xfs_buf_ioerror_alert(bp, "xlog_recover_do..(read#1)"); 2502 xfs_buf_ioerror_alert(bp, "xlog_recover_do..(read#1)");
@@ -2919,7 +2919,7 @@ out_release:
2919error: 2919error:
2920 if (need_free) 2920 if (need_free)
2921 kmem_free(in_f); 2921 kmem_free(in_f);
2922 return XFS_ERROR(error); 2922 return error;
2923} 2923}
2924 2924
2925/* 2925/*
@@ -2976,12 +2976,12 @@ xlog_recover_dquot_pass2(
2976 recddq = item->ri_buf[1].i_addr; 2976 recddq = item->ri_buf[1].i_addr;
2977 if (recddq == NULL) { 2977 if (recddq == NULL) {
2978 xfs_alert(log->l_mp, "NULL dquot in %s.", __func__); 2978 xfs_alert(log->l_mp, "NULL dquot in %s.", __func__);
2979 return XFS_ERROR(EIO); 2979 return EIO;
2980 } 2980 }
2981 if (item->ri_buf[1].i_len < sizeof(xfs_disk_dquot_t)) { 2981 if (item->ri_buf[1].i_len < sizeof(xfs_disk_dquot_t)) {
2982 xfs_alert(log->l_mp, "dquot too small (%d) in %s.", 2982 xfs_alert(log->l_mp, "dquot too small (%d) in %s.",
2983 item->ri_buf[1].i_len, __func__); 2983 item->ri_buf[1].i_len, __func__);
2984 return XFS_ERROR(EIO); 2984 return EIO;
2985 } 2985 }
2986 2986
2987 /* 2987 /*
@@ -3007,7 +3007,7 @@ xlog_recover_dquot_pass2(
3007 error = xfs_dqcheck(mp, recddq, dq_f->qlf_id, 0, XFS_QMOPT_DOWARN, 3007 error = xfs_dqcheck(mp, recddq, dq_f->qlf_id, 0, XFS_QMOPT_DOWARN,
3008 "xlog_recover_dquot_pass2 (log copy)"); 3008 "xlog_recover_dquot_pass2 (log copy)");
3009 if (error) 3009 if (error)
3010 return XFS_ERROR(EIO); 3010 return EIO;
3011 ASSERT(dq_f->qlf_len == 1); 3011 ASSERT(dq_f->qlf_len == 1);
3012 3012
3013 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dq_f->qlf_blkno, 3013 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dq_f->qlf_blkno,
@@ -3028,7 +3028,7 @@ xlog_recover_dquot_pass2(
3028 "xlog_recover_dquot_pass2"); 3028 "xlog_recover_dquot_pass2");
3029 if (error) { 3029 if (error) {
3030 xfs_buf_relse(bp); 3030 xfs_buf_relse(bp);
3031 return XFS_ERROR(EIO); 3031 return EIO;
3032 } 3032 }
3033 3033
3034 /* 3034 /*
@@ -3389,7 +3389,7 @@ xlog_recover_commit_pass1(
3389 xfs_warn(log->l_mp, "%s: invalid item type (%d)", 3389 xfs_warn(log->l_mp, "%s: invalid item type (%d)",
3390 __func__, ITEM_TYPE(item)); 3390 __func__, ITEM_TYPE(item));
3391 ASSERT(0); 3391 ASSERT(0);
3392 return XFS_ERROR(EIO); 3392 return EIO;
3393 } 3393 }
3394} 3394}
3395 3395
@@ -3425,7 +3425,7 @@ xlog_recover_commit_pass2(
3425 xfs_warn(log->l_mp, "%s: invalid item type (%d)", 3425 xfs_warn(log->l_mp, "%s: invalid item type (%d)",
3426 __func__, ITEM_TYPE(item)); 3426 __func__, ITEM_TYPE(item));
3427 ASSERT(0); 3427 ASSERT(0);
3428 return XFS_ERROR(EIO); 3428 return EIO;
3429 } 3429 }
3430} 3430}
3431 3431
@@ -3560,7 +3560,7 @@ xlog_recover_process_data(
3560 3560
3561 /* check the log format matches our own - else we can't recover */ 3561 /* check the log format matches our own - else we can't recover */
3562 if (xlog_header_check_recover(log->l_mp, rhead)) 3562 if (xlog_header_check_recover(log->l_mp, rhead))
3563 return XFS_ERROR(EIO); 3563 return EIO;
3564 3564
3565 while ((dp < lp) && num_logops) { 3565 while ((dp < lp) && num_logops) {
3566 ASSERT(dp + sizeof(xlog_op_header_t) <= lp); 3566 ASSERT(dp + sizeof(xlog_op_header_t) <= lp);
@@ -3571,7 +3571,7 @@ xlog_recover_process_data(
3571 xfs_warn(log->l_mp, "%s: bad clientid 0x%x", 3571 xfs_warn(log->l_mp, "%s: bad clientid 0x%x",
3572 __func__, ohead->oh_clientid); 3572 __func__, ohead->oh_clientid);
3573 ASSERT(0); 3573 ASSERT(0);
3574 return XFS_ERROR(EIO); 3574 return EIO;
3575 } 3575 }
3576 tid = be32_to_cpu(ohead->oh_tid); 3576 tid = be32_to_cpu(ohead->oh_tid);
3577 hash = XLOG_RHASH(tid); 3577 hash = XLOG_RHASH(tid);
@@ -3585,7 +3585,7 @@ xlog_recover_process_data(
3585 xfs_warn(log->l_mp, "%s: bad length 0x%x", 3585 xfs_warn(log->l_mp, "%s: bad length 0x%x",
3586 __func__, be32_to_cpu(ohead->oh_len)); 3586 __func__, be32_to_cpu(ohead->oh_len));
3587 WARN_ON(1); 3587 WARN_ON(1);
3588 return XFS_ERROR(EIO); 3588 return EIO;
3589 } 3589 }
3590 flags = ohead->oh_flags & ~XLOG_END_TRANS; 3590 flags = ohead->oh_flags & ~XLOG_END_TRANS;
3591 if (flags & XLOG_WAS_CONT_TRANS) 3591 if (flags & XLOG_WAS_CONT_TRANS)
@@ -3607,7 +3607,7 @@ xlog_recover_process_data(
3607 xfs_warn(log->l_mp, "%s: bad transaction", 3607 xfs_warn(log->l_mp, "%s: bad transaction",
3608 __func__); 3608 __func__);
3609 ASSERT(0); 3609 ASSERT(0);
3610 error = XFS_ERROR(EIO); 3610 error = EIO;
3611 break; 3611 break;
3612 case 0: 3612 case 0:
3613 case XLOG_CONTINUE_TRANS: 3613 case XLOG_CONTINUE_TRANS:
@@ -3618,7 +3618,7 @@ xlog_recover_process_data(
3618 xfs_warn(log->l_mp, "%s: bad flag 0x%x", 3618 xfs_warn(log->l_mp, "%s: bad flag 0x%x",
3619 __func__, flags); 3619 __func__, flags);
3620 ASSERT(0); 3620 ASSERT(0);
3621 error = XFS_ERROR(EIO); 3621 error = EIO;
3622 break; 3622 break;
3623 } 3623 }
3624 if (error) { 3624 if (error) {
@@ -3669,7 +3669,7 @@ xlog_recover_process_efi(
3669 */ 3669 */
3670 set_bit(XFS_EFI_RECOVERED, &efip->efi_flags); 3670 set_bit(XFS_EFI_RECOVERED, &efip->efi_flags);
3671 xfs_efi_release(efip, efip->efi_format.efi_nextents); 3671 xfs_efi_release(efip, efip->efi_format.efi_nextents);
3672 return XFS_ERROR(EIO); 3672 return EIO;
3673 } 3673 }
3674 } 3674 }
3675 3675
@@ -4018,14 +4018,14 @@ xlog_valid_rec_header(
4018 if (unlikely(rhead->h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM))) { 4018 if (unlikely(rhead->h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM))) {
4019 XFS_ERROR_REPORT("xlog_valid_rec_header(1)", 4019 XFS_ERROR_REPORT("xlog_valid_rec_header(1)",
4020 XFS_ERRLEVEL_LOW, log->l_mp); 4020 XFS_ERRLEVEL_LOW, log->l_mp);
4021 return XFS_ERROR(EFSCORRUPTED); 4021 return EFSCORRUPTED;
4022 } 4022 }
4023 if (unlikely( 4023 if (unlikely(
4024 (!rhead->h_version || 4024 (!rhead->h_version ||
4025 (be32_to_cpu(rhead->h_version) & (~XLOG_VERSION_OKBITS))))) { 4025 (be32_to_cpu(rhead->h_version) & (~XLOG_VERSION_OKBITS))))) {
4026 xfs_warn(log->l_mp, "%s: unrecognised log version (%d).", 4026 xfs_warn(log->l_mp, "%s: unrecognised log version (%d).",
4027 __func__, be32_to_cpu(rhead->h_version)); 4027 __func__, be32_to_cpu(rhead->h_version));
4028 return XFS_ERROR(EIO); 4028 return EIO;
4029 } 4029 }
4030 4030
4031 /* LR body must have data or it wouldn't have been written */ 4031 /* LR body must have data or it wouldn't have been written */
@@ -4033,12 +4033,12 @@ xlog_valid_rec_header(
4033 if (unlikely( hlen <= 0 || hlen > INT_MAX )) { 4033 if (unlikely( hlen <= 0 || hlen > INT_MAX )) {
4034 XFS_ERROR_REPORT("xlog_valid_rec_header(2)", 4034 XFS_ERROR_REPORT("xlog_valid_rec_header(2)",
4035 XFS_ERRLEVEL_LOW, log->l_mp); 4035 XFS_ERRLEVEL_LOW, log->l_mp);
4036 return XFS_ERROR(EFSCORRUPTED); 4036 return EFSCORRUPTED;
4037 } 4037 }
4038 if (unlikely( blkno > log->l_logBBsize || blkno > INT_MAX )) { 4038 if (unlikely( blkno > log->l_logBBsize || blkno > INT_MAX )) {
4039 XFS_ERROR_REPORT("xlog_valid_rec_header(3)", 4039 XFS_ERROR_REPORT("xlog_valid_rec_header(3)",
4040 XFS_ERRLEVEL_LOW, log->l_mp); 4040 XFS_ERRLEVEL_LOW, log->l_mp);
4041 return XFS_ERROR(EFSCORRUPTED); 4041 return EFSCORRUPTED;
4042 } 4042 }
4043 return 0; 4043 return 0;
4044} 4044}
@@ -4415,7 +4415,7 @@ xlog_do_recover(
4415 4415
4416 if (XFS_FORCED_SHUTDOWN(log->l_mp)) { 4416 if (XFS_FORCED_SHUTDOWN(log->l_mp)) {
4417 xfs_buf_relse(bp); 4417 xfs_buf_relse(bp);
4418 return XFS_ERROR(EIO); 4418 return EIO;
4419 } 4419 }
4420 4420
4421 xfs_buf_iorequest(bp); 4421 xfs_buf_iorequest(bp);
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 3507cd0ec400..b50ec92f9620 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -76,7 +76,7 @@ xfs_uuid_mount(
76 76
77 if (uuid_is_nil(uuid)) { 77 if (uuid_is_nil(uuid)) {
78 xfs_warn(mp, "Filesystem has nil UUID - can't mount"); 78 xfs_warn(mp, "Filesystem has nil UUID - can't mount");
79 return XFS_ERROR(EINVAL); 79 return EINVAL;
80 } 80 }
81 81
82 mutex_lock(&xfs_uuid_table_mutex); 82 mutex_lock(&xfs_uuid_table_mutex);
@@ -104,7 +104,7 @@ xfs_uuid_mount(
104 out_duplicate: 104 out_duplicate:
105 mutex_unlock(&xfs_uuid_table_mutex); 105 mutex_unlock(&xfs_uuid_table_mutex);
106 xfs_warn(mp, "Filesystem has duplicate UUID %pU - can't mount", uuid); 106 xfs_warn(mp, "Filesystem has duplicate UUID %pU - can't mount", uuid);
107 return XFS_ERROR(EINVAL); 107 return EINVAL;
108} 108}
109 109
110STATIC void 110STATIC void
@@ -392,7 +392,7 @@ xfs_update_alignment(xfs_mount_t *mp)
392 xfs_warn(mp, 392 xfs_warn(mp,
393 "alignment check failed: sunit/swidth vs. blocksize(%d)", 393 "alignment check failed: sunit/swidth vs. blocksize(%d)",
394 sbp->sb_blocksize); 394 sbp->sb_blocksize);
395 return XFS_ERROR(EINVAL); 395 return EINVAL;
396 } else { 396 } else {
397 /* 397 /*
398 * Convert the stripe unit and width to FSBs. 398 * Convert the stripe unit and width to FSBs.
@@ -402,14 +402,14 @@ xfs_update_alignment(xfs_mount_t *mp)
402 xfs_warn(mp, 402 xfs_warn(mp,
403 "alignment check failed: sunit/swidth vs. agsize(%d)", 403 "alignment check failed: sunit/swidth vs. agsize(%d)",
404 sbp->sb_agblocks); 404 sbp->sb_agblocks);
405 return XFS_ERROR(EINVAL); 405 return EINVAL;
406 } else if (mp->m_dalign) { 406 } else if (mp->m_dalign) {
407 mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth); 407 mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
408 } else { 408 } else {
409 xfs_warn(mp, 409 xfs_warn(mp,
410 "alignment check failed: sunit(%d) less than bsize(%d)", 410 "alignment check failed: sunit(%d) less than bsize(%d)",
411 mp->m_dalign, sbp->sb_blocksize); 411 mp->m_dalign, sbp->sb_blocksize);
412 return XFS_ERROR(EINVAL); 412 return EINVAL;
413 } 413 }
414 } 414 }
415 415
@@ -429,7 +429,7 @@ xfs_update_alignment(xfs_mount_t *mp)
429 } else { 429 } else {
430 xfs_warn(mp, 430 xfs_warn(mp,
431 "cannot change alignment: superblock does not support data alignment"); 431 "cannot change alignment: superblock does not support data alignment");
432 return XFS_ERROR(EINVAL); 432 return EINVAL;
433 } 433 }
434 } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && 434 } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN &&
435 xfs_sb_version_hasdalign(&mp->m_sb)) { 435 xfs_sb_version_hasdalign(&mp->m_sb)) {
@@ -556,7 +556,7 @@ xfs_check_sizes(xfs_mount_t *mp)
556 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); 556 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks);
557 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { 557 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) {
558 xfs_warn(mp, "filesystem size mismatch detected"); 558 xfs_warn(mp, "filesystem size mismatch detected");
559 return XFS_ERROR(EFBIG); 559 return EFBIG;
560 } 560 }
561 bp = xfs_buf_read_uncached(mp->m_ddev_targp, 561 bp = xfs_buf_read_uncached(mp->m_ddev_targp,
562 d - XFS_FSS_TO_BB(mp, 1), 562 d - XFS_FSS_TO_BB(mp, 1),
@@ -571,7 +571,7 @@ xfs_check_sizes(xfs_mount_t *mp)
571 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); 571 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
572 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { 572 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) {
573 xfs_warn(mp, "log size mismatch detected"); 573 xfs_warn(mp, "log size mismatch detected");
574 return XFS_ERROR(EFBIG); 574 return EFBIG;
575 } 575 }
576 bp = xfs_buf_read_uncached(mp->m_logdev_targp, 576 bp = xfs_buf_read_uncached(mp->m_logdev_targp,
577 d - XFS_FSB_TO_BB(mp, 1), 577 d - XFS_FSB_TO_BB(mp, 1),
@@ -816,7 +816,7 @@ xfs_mountfs(
816 if (!sbp->sb_logblocks) { 816 if (!sbp->sb_logblocks) {
817 xfs_warn(mp, "no log defined"); 817 xfs_warn(mp, "no log defined");
818 XFS_ERROR_REPORT("xfs_mountfs", XFS_ERRLEVEL_LOW, mp); 818 XFS_ERROR_REPORT("xfs_mountfs", XFS_ERRLEVEL_LOW, mp);
819 error = XFS_ERROR(EFSCORRUPTED); 819 error = EFSCORRUPTED;
820 goto out_free_perag; 820 goto out_free_perag;
821 } 821 }
822 822
@@ -876,7 +876,7 @@ xfs_mountfs(
876 xfs_iunlock(rip, XFS_ILOCK_EXCL); 876 xfs_iunlock(rip, XFS_ILOCK_EXCL);
877 XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW, 877 XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW,
878 mp); 878 mp);
879 error = XFS_ERROR(EFSCORRUPTED); 879 error = EFSCORRUPTED;
880 goto out_rele_rip; 880 goto out_rele_rip;
881 } 881 }
882 mp->m_rootip = rip; /* save it */ 882 mp->m_rootip = rip; /* save it */
@@ -1152,7 +1152,7 @@ xfs_mod_incore_sb_unlocked(
1152 lcounter += delta; 1152 lcounter += delta;
1153 if (lcounter < 0) { 1153 if (lcounter < 0) {
1154 ASSERT(0); 1154 ASSERT(0);
1155 return XFS_ERROR(EINVAL); 1155 return EINVAL;
1156 } 1156 }
1157 mp->m_sb.sb_icount = lcounter; 1157 mp->m_sb.sb_icount = lcounter;
1158 return 0; 1158 return 0;
@@ -1161,7 +1161,7 @@ xfs_mod_incore_sb_unlocked(
1161 lcounter += delta; 1161 lcounter += delta;
1162 if (lcounter < 0) { 1162 if (lcounter < 0) {
1163 ASSERT(0); 1163 ASSERT(0);
1164 return XFS_ERROR(EINVAL); 1164 return EINVAL;
1165 } 1165 }
1166 mp->m_sb.sb_ifree = lcounter; 1166 mp->m_sb.sb_ifree = lcounter;
1167 return 0; 1167 return 0;
@@ -1191,7 +1191,7 @@ xfs_mod_incore_sb_unlocked(
1191 * blocks if were allowed to. 1191 * blocks if were allowed to.
1192 */ 1192 */
1193 if (!rsvd) 1193 if (!rsvd)
1194 return XFS_ERROR(ENOSPC); 1194 return ENOSPC;
1195 1195
1196 lcounter = (long long)mp->m_resblks_avail + delta; 1196 lcounter = (long long)mp->m_resblks_avail + delta;
1197 if (lcounter >= 0) { 1197 if (lcounter >= 0) {
@@ -1202,7 +1202,7 @@ xfs_mod_incore_sb_unlocked(
1202 "Filesystem \"%s\": reserve blocks depleted! " 1202 "Filesystem \"%s\": reserve blocks depleted! "
1203 "Consider increasing reserve pool size.", 1203 "Consider increasing reserve pool size.",
1204 mp->m_fsname); 1204 mp->m_fsname);
1205 return XFS_ERROR(ENOSPC); 1205 return ENOSPC;
1206 } 1206 }
1207 1207
1208 mp->m_sb.sb_fdblocks = lcounter + XFS_ALLOC_SET_ASIDE(mp); 1208 mp->m_sb.sb_fdblocks = lcounter + XFS_ALLOC_SET_ASIDE(mp);
@@ -1211,7 +1211,7 @@ xfs_mod_incore_sb_unlocked(
1211 lcounter = (long long)mp->m_sb.sb_frextents; 1211 lcounter = (long long)mp->m_sb.sb_frextents;
1212 lcounter += delta; 1212 lcounter += delta;
1213 if (lcounter < 0) { 1213 if (lcounter < 0) {
1214 return XFS_ERROR(ENOSPC); 1214 return ENOSPC;
1215 } 1215 }
1216 mp->m_sb.sb_frextents = lcounter; 1216 mp->m_sb.sb_frextents = lcounter;
1217 return 0; 1217 return 0;
@@ -1220,7 +1220,7 @@ xfs_mod_incore_sb_unlocked(
1220 lcounter += delta; 1220 lcounter += delta;
1221 if (lcounter < 0) { 1221 if (lcounter < 0) {
1222 ASSERT(0); 1222 ASSERT(0);
1223 return XFS_ERROR(EINVAL); 1223 return EINVAL;
1224 } 1224 }
1225 mp->m_sb.sb_dblocks = lcounter; 1225 mp->m_sb.sb_dblocks = lcounter;
1226 return 0; 1226 return 0;
@@ -1229,7 +1229,7 @@ xfs_mod_incore_sb_unlocked(
1229 scounter += delta; 1229 scounter += delta;
1230 if (scounter < 0) { 1230 if (scounter < 0) {
1231 ASSERT(0); 1231 ASSERT(0);
1232 return XFS_ERROR(EINVAL); 1232 return EINVAL;
1233 } 1233 }
1234 mp->m_sb.sb_agcount = scounter; 1234 mp->m_sb.sb_agcount = scounter;
1235 return 0; 1235 return 0;
@@ -1238,7 +1238,7 @@ xfs_mod_incore_sb_unlocked(
1238 scounter += delta; 1238 scounter += delta;
1239 if (scounter < 0) { 1239 if (scounter < 0) {
1240 ASSERT(0); 1240 ASSERT(0);
1241 return XFS_ERROR(EINVAL); 1241 return EINVAL;
1242 } 1242 }
1243 mp->m_sb.sb_imax_pct = scounter; 1243 mp->m_sb.sb_imax_pct = scounter;
1244 return 0; 1244 return 0;
@@ -1247,7 +1247,7 @@ xfs_mod_incore_sb_unlocked(
1247 scounter += delta; 1247 scounter += delta;
1248 if (scounter < 0) { 1248 if (scounter < 0) {
1249 ASSERT(0); 1249 ASSERT(0);
1250 return XFS_ERROR(EINVAL); 1250 return EINVAL;
1251 } 1251 }
1252 mp->m_sb.sb_rextsize = scounter; 1252 mp->m_sb.sb_rextsize = scounter;
1253 return 0; 1253 return 0;
@@ -1256,7 +1256,7 @@ xfs_mod_incore_sb_unlocked(
1256 scounter += delta; 1256 scounter += delta;
1257 if (scounter < 0) { 1257 if (scounter < 0) {
1258 ASSERT(0); 1258 ASSERT(0);
1259 return XFS_ERROR(EINVAL); 1259 return EINVAL;
1260 } 1260 }
1261 mp->m_sb.sb_rbmblocks = scounter; 1261 mp->m_sb.sb_rbmblocks = scounter;
1262 return 0; 1262 return 0;
@@ -1265,7 +1265,7 @@ xfs_mod_incore_sb_unlocked(
1265 lcounter += delta; 1265 lcounter += delta;
1266 if (lcounter < 0) { 1266 if (lcounter < 0) {
1267 ASSERT(0); 1267 ASSERT(0);
1268 return XFS_ERROR(EINVAL); 1268 return EINVAL;
1269 } 1269 }
1270 mp->m_sb.sb_rblocks = lcounter; 1270 mp->m_sb.sb_rblocks = lcounter;
1271 return 0; 1271 return 0;
@@ -1274,7 +1274,7 @@ xfs_mod_incore_sb_unlocked(
1274 lcounter += delta; 1274 lcounter += delta;
1275 if (lcounter < 0) { 1275 if (lcounter < 0) {
1276 ASSERT(0); 1276 ASSERT(0);
1277 return XFS_ERROR(EINVAL); 1277 return EINVAL;
1278 } 1278 }
1279 mp->m_sb.sb_rextents = lcounter; 1279 mp->m_sb.sb_rextents = lcounter;
1280 return 0; 1280 return 0;
@@ -1283,13 +1283,13 @@ xfs_mod_incore_sb_unlocked(
1283 scounter += delta; 1283 scounter += delta;
1284 if (scounter < 0) { 1284 if (scounter < 0) {
1285 ASSERT(0); 1285 ASSERT(0);
1286 return XFS_ERROR(EINVAL); 1286 return EINVAL;
1287 } 1287 }
1288 mp->m_sb.sb_rextslog = scounter; 1288 mp->m_sb.sb_rextslog = scounter;
1289 return 0; 1289 return 0;
1290 default: 1290 default:
1291 ASSERT(0); 1291 ASSERT(0);
1292 return XFS_ERROR(EINVAL); 1292 return EINVAL;
1293 } 1293 }
1294} 1294}
1295 1295
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 882440ff964f..a97d94d69a1e 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1226,7 +1226,7 @@ xfs_qm_dqusage_adjust(
1226 */ 1226 */
1227 if (xfs_is_quota_inode(&mp->m_sb, ino)) { 1227 if (xfs_is_quota_inode(&mp->m_sb, ino)) {
1228 *res = BULKSTAT_RV_NOTHING; 1228 *res = BULKSTAT_RV_NOTHING;
1229 return XFS_ERROR(EINVAL); 1229 return EINVAL;
1230 } 1230 }
1231 1231
1232 /* 1232 /*
@@ -1493,7 +1493,7 @@ xfs_qm_init_quotainos(
1493 error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, 1493 error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
1494 0, 0, &uip); 1494 0, 0, &uip);
1495 if (error) 1495 if (error)
1496 return XFS_ERROR(error); 1496 return error;
1497 } 1497 }
1498 if (XFS_IS_GQUOTA_ON(mp) && 1498 if (XFS_IS_GQUOTA_ON(mp) &&
1499 mp->m_sb.sb_gquotino != NULLFSINO) { 1499 mp->m_sb.sb_gquotino != NULLFSINO) {
@@ -1563,7 +1563,7 @@ error_rele:
1563 IRELE(gip); 1563 IRELE(gip);
1564 if (pip) 1564 if (pip)
1565 IRELE(pip); 1565 IRELE(pip);
1566 return XFS_ERROR(error); 1566 return error;
1567} 1567}
1568 1568
1569STATIC void 1569STATIC void
diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c
index e9be63abd8d2..fa9797382d5b 100644
--- a/fs/xfs/xfs_qm_bhv.c
+++ b/fs/xfs/xfs_qm_bhv.c
@@ -117,7 +117,7 @@ xfs_qm_newmount(
117 (uquotaondisk ? " usrquota" : ""), 117 (uquotaondisk ? " usrquota" : ""),
118 (gquotaondisk ? " grpquota" : ""), 118 (gquotaondisk ? " grpquota" : ""),
119 (pquotaondisk ? " prjquota" : "")); 119 (pquotaondisk ? " prjquota" : ""));
120 return XFS_ERROR(EPERM); 120 return EPERM;
121 } 121 }
122 122
123 if (XFS_IS_QUOTA_ON(mp) || quotaondisk) { 123 if (XFS_IS_QUOTA_ON(mp) || quotaondisk) {
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index e6c26d564b17..f5167e837828 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -67,7 +67,7 @@ xfs_qm_scall_quotaoff(
67 * errno == EEXIST here. 67 * errno == EEXIST here.
68 */ 68 */
69 if ((mp->m_qflags & flags) == 0) 69 if ((mp->m_qflags & flags) == 0)
70 return XFS_ERROR(EEXIST); 70 return EEXIST;
71 error = 0; 71 error = 0;
72 72
73 flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD); 73 flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD);
@@ -284,7 +284,7 @@ xfs_qm_scall_trunc_qfiles(
284 (flags & ~XFS_DQ_ALLTYPES)) { 284 (flags & ~XFS_DQ_ALLTYPES)) {
285 xfs_debug(mp, "%s: flags=%x m_qflags=%x", 285 xfs_debug(mp, "%s: flags=%x m_qflags=%x",
286 __func__, flags, mp->m_qflags); 286 __func__, flags, mp->m_qflags);
287 return XFS_ERROR(EINVAL); 287 return EINVAL;
288 } 288 }
289 289
290 if (flags & XFS_DQ_USER) { 290 if (flags & XFS_DQ_USER) {
@@ -328,7 +328,7 @@ xfs_qm_scall_quotaon(
328 if (flags == 0) { 328 if (flags == 0) {
329 xfs_debug(mp, "%s: zero flags, m_qflags=%x", 329 xfs_debug(mp, "%s: zero flags, m_qflags=%x",
330 __func__, mp->m_qflags); 330 __func__, mp->m_qflags);
331 return XFS_ERROR(EINVAL); 331 return EINVAL;
332 } 332 }
333 333
334 /* No fs can turn on quotas with a delayed effect */ 334 /* No fs can turn on quotas with a delayed effect */
@@ -351,13 +351,13 @@ xfs_qm_scall_quotaon(
351 xfs_debug(mp, 351 xfs_debug(mp,
352 "%s: Can't enforce without acct, flags=%x sbflags=%x", 352 "%s: Can't enforce without acct, flags=%x sbflags=%x",
353 __func__, flags, mp->m_sb.sb_qflags); 353 __func__, flags, mp->m_sb.sb_qflags);
354 return XFS_ERROR(EINVAL); 354 return EINVAL;
355 } 355 }
356 /* 356 /*
357 * If everything's up to-date incore, then don't waste time. 357 * If everything's up to-date incore, then don't waste time.
358 */ 358 */
359 if ((mp->m_qflags & flags) == flags) 359 if ((mp->m_qflags & flags) == flags)
360 return XFS_ERROR(EEXIST); 360 return EEXIST;
361 361
362 /* 362 /*
363 * Change sb_qflags on disk but not incore mp->qflags 363 * Change sb_qflags on disk but not incore mp->qflags
@@ -372,7 +372,7 @@ xfs_qm_scall_quotaon(
372 * There's nothing to change if it's the same. 372 * There's nothing to change if it's the same.
373 */ 373 */
374 if ((qf & flags) == flags && sbflags == 0) 374 if ((qf & flags) == flags && sbflags == 0)
375 return XFS_ERROR(EEXIST); 375 return EEXIST;
376 sbflags |= XFS_SB_QFLAGS; 376 sbflags |= XFS_SB_QFLAGS;
377 377
378 if ((error = xfs_qm_write_sb_changes(mp, sbflags))) 378 if ((error = xfs_qm_write_sb_changes(mp, sbflags)))
@@ -390,7 +390,7 @@ xfs_qm_scall_quotaon(
390 return 0; 390 return 0;
391 391
392 if (! XFS_IS_QUOTA_RUNNING(mp)) 392 if (! XFS_IS_QUOTA_RUNNING(mp))
393 return XFS_ERROR(ESRCH); 393 return ESRCH;
394 394
395 /* 395 /*
396 * Switch on quota enforcement in core. 396 * Switch on quota enforcement in core.
@@ -850,7 +850,7 @@ xfs_qm_scall_getquota(
850 * our utility programs are concerned. 850 * our utility programs are concerned.
851 */ 851 */
852 if (XFS_IS_DQUOT_UNINITIALIZED(dqp)) { 852 if (XFS_IS_DQUOT_UNINITIALIZED(dqp)) {
853 error = XFS_ERROR(ENOENT); 853 error = ENOENT;
854 goto out_put; 854 goto out_put;
855 } 855 }
856 856
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index ec5ca65c6211..1a98a783cf4b 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -863,7 +863,7 @@ xfs_growfs_rt_alloc(
863 XFS_BMAPI_METADATA, &firstblock, 863 XFS_BMAPI_METADATA, &firstblock,
864 resblks, &map, &nmap, &flist); 864 resblks, &map, &nmap, &flist);
865 if (!error && nmap < 1) 865 if (!error && nmap < 1)
866 error = XFS_ERROR(ENOSPC); 866 error = ENOSPC;
867 if (error) 867 if (error)
868 goto error_cancel; 868 goto error_cancel;
869 /* 869 /*
@@ -903,7 +903,7 @@ xfs_growfs_rt_alloc(
903 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, 903 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
904 mp->m_bsize, 0); 904 mp->m_bsize, 0);
905 if (bp == NULL) { 905 if (bp == NULL) {
906 error = XFS_ERROR(EIO); 906 error = EIO;
907error_cancel: 907error_cancel:
908 xfs_trans_cancel(tp, cancelflags); 908 xfs_trans_cancel(tp, cancelflags);
909 goto error; 909 goto error;
@@ -962,11 +962,11 @@ xfs_growfs_rt(
962 * Initial error checking. 962 * Initial error checking.
963 */ 963 */
964 if (!capable(CAP_SYS_ADMIN)) 964 if (!capable(CAP_SYS_ADMIN))
965 return XFS_ERROR(EPERM); 965 return EPERM;
966 if (mp->m_rtdev_targp == NULL || mp->m_rbmip == NULL || 966 if (mp->m_rtdev_targp == NULL || mp->m_rbmip == NULL ||
967 (nrblocks = in->newblocks) <= sbp->sb_rblocks || 967 (nrblocks = in->newblocks) <= sbp->sb_rblocks ||
968 (sbp->sb_rblocks && (in->extsize != sbp->sb_rextsize))) 968 (sbp->sb_rblocks && (in->extsize != sbp->sb_rextsize)))
969 return XFS_ERROR(EINVAL); 969 return EINVAL;
970 if ((error = xfs_sb_validate_fsb_count(sbp, nrblocks))) 970 if ((error = xfs_sb_validate_fsb_count(sbp, nrblocks)))
971 return error; 971 return error;
972 /* 972 /*
@@ -1001,7 +1001,7 @@ xfs_growfs_rt(
1001 * since we'll log basically the whole summary file at once. 1001 * since we'll log basically the whole summary file at once.
1002 */ 1002 */
1003 if (nrsumblocks > (mp->m_sb.sb_logblocks >> 1)) 1003 if (nrsumblocks > (mp->m_sb.sb_logblocks >> 1))
1004 return XFS_ERROR(EINVAL); 1004 return EINVAL;
1005 /* 1005 /*
1006 * Get the old block counts for bitmap and summary inodes. 1006 * Get the old block counts for bitmap and summary inodes.
1007 * These can't change since other growfs callers are locked out. 1007 * These can't change since other growfs callers are locked out.
@@ -1247,7 +1247,7 @@ xfs_rtmount_init(
1247 if (mp->m_rtdev_targp == NULL) { 1247 if (mp->m_rtdev_targp == NULL) {
1248 xfs_warn(mp, 1248 xfs_warn(mp,
1249 "Filesystem has a realtime volume, use rtdev=device option"); 1249 "Filesystem has a realtime volume, use rtdev=device option");
1250 return XFS_ERROR(ENODEV); 1250 return ENODEV;
1251 } 1251 }
1252 mp->m_rsumlevels = sbp->sb_rextslog + 1; 1252 mp->m_rsumlevels = sbp->sb_rextslog + 1;
1253 mp->m_rsumsize = 1253 mp->m_rsumsize =
@@ -1263,7 +1263,7 @@ xfs_rtmount_init(
1263 xfs_warn(mp, "realtime mount -- %llu != %llu", 1263 xfs_warn(mp, "realtime mount -- %llu != %llu",
1264 (unsigned long long) XFS_BB_TO_FSB(mp, d), 1264 (unsigned long long) XFS_BB_TO_FSB(mp, d),
1265 (unsigned long long) mp->m_sb.sb_rblocks); 1265 (unsigned long long) mp->m_sb.sb_rblocks);
1266 return XFS_ERROR(EFBIG); 1266 return EFBIG;
1267 } 1267 }
1268 bp = xfs_buf_read_uncached(mp->m_rtdev_targp, 1268 bp = xfs_buf_read_uncached(mp->m_rtdev_targp,
1269 d - XFS_FSB_TO_BB(mp, 1), 1269 d - XFS_FSB_TO_BB(mp, 1),
diff --git a/fs/xfs/xfs_sb.c b/fs/xfs/xfs_sb.c
index c3453b11f563..06ad60b4b9fd 100644
--- a/fs/xfs/xfs_sb.c
+++ b/fs/xfs/xfs_sb.c
@@ -186,13 +186,13 @@ xfs_mount_validate_sb(
186 */ 186 */
187 if (sbp->sb_magicnum != XFS_SB_MAGIC) { 187 if (sbp->sb_magicnum != XFS_SB_MAGIC) {
188 xfs_warn(mp, "bad magic number"); 188 xfs_warn(mp, "bad magic number");
189 return XFS_ERROR(EWRONGFS); 189 return EWRONGFS;
190 } 190 }
191 191
192 192
193 if (!xfs_sb_good_version(sbp)) { 193 if (!xfs_sb_good_version(sbp)) {
194 xfs_warn(mp, "bad version"); 194 xfs_warn(mp, "bad version");
195 return XFS_ERROR(EWRONGFS); 195 return EWRONGFS;
196 } 196 }
197 197
198 /* 198 /*
@@ -220,7 +220,7 @@ xfs_mount_validate_sb(
220 xfs_warn(mp, 220 xfs_warn(mp,
221"Attempted to mount read-only compatible filesystem read-write.\n" 221"Attempted to mount read-only compatible filesystem read-write.\n"
222"Filesystem can only be safely mounted read only."); 222"Filesystem can only be safely mounted read only.");
223 return XFS_ERROR(EINVAL); 223 return EINVAL;
224 } 224 }
225 } 225 }
226 if (xfs_sb_has_incompat_feature(sbp, 226 if (xfs_sb_has_incompat_feature(sbp,
@@ -230,7 +230,7 @@ xfs_mount_validate_sb(
230"Filesystem can not be safely mounted by this kernel.", 230"Filesystem can not be safely mounted by this kernel.",
231 (sbp->sb_features_incompat & 231 (sbp->sb_features_incompat &
232 XFS_SB_FEAT_INCOMPAT_UNKNOWN)); 232 XFS_SB_FEAT_INCOMPAT_UNKNOWN));
233 return XFS_ERROR(EINVAL); 233 return EINVAL;
234 } 234 }
235 } 235 }
236 236
@@ -238,13 +238,13 @@ xfs_mount_validate_sb(
238 if (sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) { 238 if (sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) {
239 xfs_notice(mp, 239 xfs_notice(mp,
240 "Version 5 of Super block has XFS_OQUOTA bits."); 240 "Version 5 of Super block has XFS_OQUOTA bits.");
241 return XFS_ERROR(EFSCORRUPTED); 241 return EFSCORRUPTED;
242 } 242 }
243 } else if (sbp->sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD | 243 } else if (sbp->sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD |
244 XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) { 244 XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) {
245 xfs_notice(mp, 245 xfs_notice(mp,
246"Superblock earlier than Version 5 has XFS_[PQ]UOTA_{ENFD|CHKD} bits."); 246"Superblock earlier than Version 5 has XFS_[PQ]UOTA_{ENFD|CHKD} bits.");
247 return XFS_ERROR(EFSCORRUPTED); 247 return EFSCORRUPTED;
248 } 248 }
249 249
250 if (unlikely( 250 if (unlikely(
@@ -252,7 +252,7 @@ xfs_mount_validate_sb(
252 xfs_warn(mp, 252 xfs_warn(mp,
253 "filesystem is marked as having an external log; " 253 "filesystem is marked as having an external log; "
254 "specify logdev on the mount command line."); 254 "specify logdev on the mount command line.");
255 return XFS_ERROR(EINVAL); 255 return EINVAL;
256 } 256 }
257 257
258 if (unlikely( 258 if (unlikely(
@@ -260,7 +260,7 @@ xfs_mount_validate_sb(
260 xfs_warn(mp, 260 xfs_warn(mp,
261 "filesystem is marked as having an internal log; " 261 "filesystem is marked as having an internal log; "
262 "do not specify logdev on the mount command line."); 262 "do not specify logdev on the mount command line.");
263 return XFS_ERROR(EINVAL); 263 return EINVAL;
264 } 264 }
265 265
266 /* 266 /*
@@ -294,7 +294,7 @@ xfs_mount_validate_sb(
294 sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp) || 294 sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp) ||
295 sbp->sb_shared_vn != 0)) { 295 sbp->sb_shared_vn != 0)) {
296 xfs_notice(mp, "SB sanity check failed"); 296 xfs_notice(mp, "SB sanity check failed");
297 return XFS_ERROR(EFSCORRUPTED); 297 return EFSCORRUPTED;
298 } 298 }
299 299
300 /* 300 /*
@@ -305,7 +305,7 @@ xfs_mount_validate_sb(
305 "File system with blocksize %d bytes. " 305 "File system with blocksize %d bytes. "
306 "Only pagesize (%ld) or less will currently work.", 306 "Only pagesize (%ld) or less will currently work.",
307 sbp->sb_blocksize, PAGE_SIZE); 307 sbp->sb_blocksize, PAGE_SIZE);
308 return XFS_ERROR(ENOSYS); 308 return ENOSYS;
309 } 309 }
310 310
311 /* 311 /*
@@ -320,19 +320,19 @@ xfs_mount_validate_sb(
320 default: 320 default:
321 xfs_warn(mp, "inode size of %d bytes not supported", 321 xfs_warn(mp, "inode size of %d bytes not supported",
322 sbp->sb_inodesize); 322 sbp->sb_inodesize);
323 return XFS_ERROR(ENOSYS); 323 return ENOSYS;
324 } 324 }
325 325
326 if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) || 326 if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) ||
327 xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) { 327 xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) {
328 xfs_warn(mp, 328 xfs_warn(mp,
329 "file system too large to be mounted on this system."); 329 "file system too large to be mounted on this system.");
330 return XFS_ERROR(EFBIG); 330 return EFBIG;
331 } 331 }
332 332
333 if (check_inprogress && sbp->sb_inprogress) { 333 if (check_inprogress && sbp->sb_inprogress) {
334 xfs_warn(mp, "Offline file system operation in progress!"); 334 xfs_warn(mp, "Offline file system operation in progress!");
335 return XFS_ERROR(EFSCORRUPTED); 335 return EFSCORRUPTED;
336 } 336 }
337 return 0; 337 return 0;
338} 338}
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 8f0333b3f7a0..12d3ad3203ff 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -446,7 +446,7 @@ done:
446 mp->m_logbufs > XLOG_MAX_ICLOGS)) { 446 mp->m_logbufs > XLOG_MAX_ICLOGS)) {
447 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", 447 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]",
448 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); 448 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS);
449 return XFS_ERROR(EINVAL); 449 return EINVAL;
450 } 450 }
451 if (mp->m_logbsize != -1 && 451 if (mp->m_logbsize != -1 &&
452 mp->m_logbsize != 0 && 452 mp->m_logbsize != 0 &&
@@ -456,7 +456,7 @@ done:
456 xfs_warn(mp, 456 xfs_warn(mp,
457 "invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]", 457 "invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
458 mp->m_logbsize); 458 mp->m_logbsize);
459 return XFS_ERROR(EINVAL); 459 return EINVAL;
460 } 460 }
461 461
462 if (iosizelog) { 462 if (iosizelog) {
@@ -465,7 +465,7 @@ done:
465 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", 465 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
466 iosizelog, XFS_MIN_IO_LOG, 466 iosizelog, XFS_MIN_IO_LOG,
467 XFS_MAX_IO_LOG); 467 XFS_MAX_IO_LOG);
468 return XFS_ERROR(EINVAL); 468 return EINVAL;
469 } 469 }
470 470
471 mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE; 471 mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
@@ -1336,14 +1336,14 @@ xfs_finish_flags(
1336 mp->m_logbsize < mp->m_sb.sb_logsunit) { 1336 mp->m_logbsize < mp->m_sb.sb_logsunit) {
1337 xfs_warn(mp, 1337 xfs_warn(mp,
1338 "logbuf size must be greater than or equal to log stripe size"); 1338 "logbuf size must be greater than or equal to log stripe size");
1339 return XFS_ERROR(EINVAL); 1339 return EINVAL;
1340 } 1340 }
1341 } else { 1341 } else {
1342 /* Fail a mount if the logbuf is larger than 32K */ 1342 /* Fail a mount if the logbuf is larger than 32K */
1343 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { 1343 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) {
1344 xfs_warn(mp, 1344 xfs_warn(mp,
1345 "logbuf size for version 1 logs must be 16K or 32K"); 1345 "logbuf size for version 1 logs must be 16K or 32K");
1346 return XFS_ERROR(EINVAL); 1346 return EINVAL;
1347 } 1347 }
1348 } 1348 }
1349 1349
@@ -1355,7 +1355,7 @@ xfs_finish_flags(
1355 xfs_warn(mp, 1355 xfs_warn(mp,
1356"Cannot mount a V5 filesystem as %s. %s is always enabled for V5 filesystems.", 1356"Cannot mount a V5 filesystem as %s. %s is always enabled for V5 filesystems.",
1357 MNTOPT_NOATTR2, MNTOPT_ATTR2); 1357 MNTOPT_NOATTR2, MNTOPT_ATTR2);
1358 return XFS_ERROR(EINVAL); 1358 return EINVAL;
1359 } 1359 }
1360 1360
1361 /* 1361 /*
@@ -1372,7 +1372,7 @@ xfs_finish_flags(
1372 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !ronly) { 1372 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !ronly) {
1373 xfs_warn(mp, 1373 xfs_warn(mp,
1374 "cannot mount a read-only filesystem as read-write"); 1374 "cannot mount a read-only filesystem as read-write");
1375 return XFS_ERROR(EROFS); 1375 return EROFS;
1376 } 1376 }
1377 1377
1378 if ((mp->m_qflags & (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE)) && 1378 if ((mp->m_qflags & (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE)) &&
@@ -1380,7 +1380,7 @@ xfs_finish_flags(
1380 !xfs_sb_version_has_pquotino(&mp->m_sb)) { 1380 !xfs_sb_version_has_pquotino(&mp->m_sb)) {
1381 xfs_warn(mp, 1381 xfs_warn(mp,
1382 "Super block does not support project and group quota together"); 1382 "Super block does not support project and group quota together");
1383 return XFS_ERROR(EINVAL); 1383 return EINVAL;
1384 } 1384 }
1385 1385
1386 return 0; 1386 return 0;
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index d69363c833e1..c2c8173d1634 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -76,7 +76,7 @@ xfs_readlink_bmap(
76 bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0, 76 bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0,
77 &xfs_symlink_buf_ops); 77 &xfs_symlink_buf_ops);
78 if (!bp) 78 if (!bp)
79 return XFS_ERROR(ENOMEM); 79 return ENOMEM;
80 error = bp->b_error; 80 error = bp->b_error;
81 if (error) { 81 if (error) {
82 xfs_buf_ioerror_alert(bp, __func__); 82 xfs_buf_ioerror_alert(bp, __func__);
@@ -135,7 +135,7 @@ xfs_readlink(
135 trace_xfs_readlink(ip); 135 trace_xfs_readlink(ip);
136 136
137 if (XFS_FORCED_SHUTDOWN(mp)) 137 if (XFS_FORCED_SHUTDOWN(mp))
138 return XFS_ERROR(EIO); 138 return EIO;
139 139
140 xfs_ilock(ip, XFS_ILOCK_SHARED); 140 xfs_ilock(ip, XFS_ILOCK_SHARED);
141 141
@@ -148,7 +148,7 @@ xfs_readlink(
148 __func__, (unsigned long long) ip->i_ino, 148 __func__, (unsigned long long) ip->i_ino,
149 (long long) pathlen); 149 (long long) pathlen);
150 ASSERT(0); 150 ASSERT(0);
151 error = XFS_ERROR(EFSCORRUPTED); 151 error = EFSCORRUPTED;
152 goto out; 152 goto out;
153 } 153 }
154 154
@@ -203,14 +203,14 @@ xfs_symlink(
203 trace_xfs_symlink(dp, link_name); 203 trace_xfs_symlink(dp, link_name);
204 204
205 if (XFS_FORCED_SHUTDOWN(mp)) 205 if (XFS_FORCED_SHUTDOWN(mp))
206 return XFS_ERROR(EIO); 206 return EIO;
207 207
208 /* 208 /*
209 * Check component lengths of the target path name. 209 * Check component lengths of the target path name.
210 */ 210 */
211 pathlen = strlen(target_path); 211 pathlen = strlen(target_path);
212 if (pathlen >= MAXPATHLEN) /* total string too long */ 212 if (pathlen >= MAXPATHLEN) /* total string too long */
213 return XFS_ERROR(ENAMETOOLONG); 213 return ENAMETOOLONG;
214 214
215 udqp = gdqp = NULL; 215 udqp = gdqp = NULL;
216 prid = xfs_get_initial_prid(dp); 216 prid = xfs_get_initial_prid(dp);
@@ -254,7 +254,7 @@ xfs_symlink(
254 * Check whether the directory allows new symlinks or not. 254 * Check whether the directory allows new symlinks or not.
255 */ 255 */
256 if (dp->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) { 256 if (dp->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) {
257 error = XFS_ERROR(EPERM); 257 error = EPERM;
258 goto error_return; 258 goto error_return;
259 } 259 }
260 260
@@ -562,7 +562,7 @@ xfs_inactive_symlink(
562 trace_xfs_inactive_symlink(ip); 562 trace_xfs_inactive_symlink(ip);
563 563
564 if (XFS_FORCED_SHUTDOWN(mp)) 564 if (XFS_FORCED_SHUTDOWN(mp))
565 return XFS_ERROR(EIO); 565 return EIO;
566 566
567 xfs_ilock(ip, XFS_ILOCK_EXCL); 567 xfs_ilock(ip, XFS_ILOCK_EXCL);
568 568
@@ -580,7 +580,7 @@ xfs_inactive_symlink(
580 __func__, (unsigned long long)ip->i_ino, pathlen); 580 __func__, (unsigned long long)ip->i_ino, pathlen);
581 xfs_iunlock(ip, XFS_ILOCK_EXCL); 581 xfs_iunlock(ip, XFS_ILOCK_EXCL);
582 ASSERT(0); 582 ASSERT(0);
583 return XFS_ERROR(EFSCORRUPTED); 583 return EFSCORRUPTED;
584 } 584 }
585 585
586 if (ip->i_df.if_flags & XFS_IFINLINE) { 586 if (ip->i_df.if_flags & XFS_IFINLINE) {
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index e15fe67baa7b..6b9b48dfddaa 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -190,7 +190,7 @@ xfs_trans_reserve(
190 -((int64_t)blocks), rsvd); 190 -((int64_t)blocks), rsvd);
191 if (error != 0) { 191 if (error != 0) {
192 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); 192 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS);
193 return XFS_ERROR(ENOSPC); 193 return ENOSPC;
194 } 194 }
195 tp->t_blk_res += blocks; 195 tp->t_blk_res += blocks;
196 } 196 }
@@ -241,7 +241,7 @@ xfs_trans_reserve(
241 error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FREXTENTS, 241 error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FREXTENTS,
242 -((int64_t)rtextents), rsvd); 242 -((int64_t)rtextents), rsvd);
243 if (error) { 243 if (error) {
244 error = XFS_ERROR(ENOSPC); 244 error = ENOSPC;
245 goto undo_log; 245 goto undo_log;
246 } 246 }
247 tp->t_rtx_res += rtextents; 247 tp->t_rtx_res += rtextents;
@@ -874,7 +874,7 @@ xfs_trans_commit(
874 goto out_unreserve; 874 goto out_unreserve;
875 875
876 if (XFS_FORCED_SHUTDOWN(mp)) { 876 if (XFS_FORCED_SHUTDOWN(mp)) {
877 error = XFS_ERROR(EIO); 877 error = EIO;
878 goto out_unreserve; 878 goto out_unreserve;
879 } 879 }
880 880
@@ -917,7 +917,7 @@ out_unreserve:
917 if (tp->t_ticket) { 917 if (tp->t_ticket) {
918 commit_lsn = xfs_log_done(mp, tp->t_ticket, NULL, log_flags); 918 commit_lsn = xfs_log_done(mp, tp->t_ticket, NULL, log_flags);
919 if (commit_lsn == -1 && !error) 919 if (commit_lsn == -1 && !error)
920 error = XFS_ERROR(EIO); 920 error = EIO;
921 } 921 }
922 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); 922 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS);
923 xfs_trans_free_items(tp, NULLCOMMITLSN, error ? XFS_TRANS_ABORT : 0); 923 xfs_trans_free_items(tp, NULLCOMMITLSN, error ? XFS_TRANS_ABORT : 0);
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index fe41e8efbe96..33bf55d7403a 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -266,7 +266,7 @@ xfs_trans_read_buf_map(
266 bp = xfs_buf_read_map(target, map, nmaps, flags, ops); 266 bp = xfs_buf_read_map(target, map, nmaps, flags, ops);
267 if (!bp) 267 if (!bp)
268 return (flags & XBF_TRYLOCK) ? 268 return (flags & XBF_TRYLOCK) ?
269 EAGAIN : XFS_ERROR(ENOMEM); 269 EAGAIN : ENOMEM;
270 270
271 if (bp->b_error) { 271 if (bp->b_error) {
272 error = bp->b_error; 272 error = bp->b_error;
@@ -286,7 +286,7 @@ xfs_trans_read_buf_map(
286 if (((xfs_req_num++) % xfs_error_mod) == 0) { 286 if (((xfs_req_num++) % xfs_error_mod) == 0) {
287 xfs_buf_relse(bp); 287 xfs_buf_relse(bp);
288 xfs_debug(mp, "Returning error!"); 288 xfs_debug(mp, "Returning error!");
289 return XFS_ERROR(EIO); 289 return EIO;
290 } 290 }
291 } 291 }
292 } 292 }
@@ -354,7 +354,7 @@ xfs_trans_read_buf_map(
354 if (XFS_FORCED_SHUTDOWN(mp)) { 354 if (XFS_FORCED_SHUTDOWN(mp)) {
355 trace_xfs_trans_read_buf_shut(bp, _RET_IP_); 355 trace_xfs_trans_read_buf_shut(bp, _RET_IP_);
356 *bpp = NULL; 356 *bpp = NULL;
357 return XFS_ERROR(EIO); 357 return EIO;
358 } 358 }
359 359
360 360
@@ -371,7 +371,7 @@ xfs_trans_read_buf_map(
371 if (bp == NULL) { 371 if (bp == NULL) {
372 *bpp = NULL; 372 *bpp = NULL;
373 return (flags & XBF_TRYLOCK) ? 373 return (flags & XBF_TRYLOCK) ?
374 0 : XFS_ERROR(ENOMEM); 374 0 : ENOMEM;
375 } 375 }
376 if (bp->b_error) { 376 if (bp->b_error) {
377 error = bp->b_error; 377 error = bp->b_error;
@@ -395,7 +395,7 @@ xfs_trans_read_buf_map(
395 SHUTDOWN_META_IO_ERROR); 395 SHUTDOWN_META_IO_ERROR);
396 xfs_buf_relse(bp); 396 xfs_buf_relse(bp);
397 xfs_debug(mp, "Returning trans error!"); 397 xfs_debug(mp, "Returning trans error!");
398 return XFS_ERROR(EIO); 398 return EIO;
399 } 399 }
400 } 400 }
401 } 401 }
@@ -413,7 +413,7 @@ shutdown_abort:
413 trace_xfs_trans_read_buf_shut(bp, _RET_IP_); 413 trace_xfs_trans_read_buf_shut(bp, _RET_IP_);
414 xfs_buf_relse(bp); 414 xfs_buf_relse(bp);
415 *bpp = NULL; 415 *bpp = NULL;
416 return XFS_ERROR(EIO); 416 return EIO;
417} 417}
418 418
419/* 419/*