aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/libxfs/xfs_attr.c28
-rw-r--r--fs/xfs/libxfs/xfs_attr_remote.c10
-rw-r--r--fs/xfs/xfs_bmap_util.c12
-rw-r--r--fs/xfs/xfs_inode.c10
4 files changed, 16 insertions, 44 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 1e671d4eb6fa..c6299f82a6e4 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -587,7 +587,7 @@ xfs_attr_leaf_addname(
587 */ 587 */
588 error = xfs_attr3_leaf_to_node(args); 588 error = xfs_attr3_leaf_to_node(args);
589 if (error) 589 if (error)
590 goto out_defer_cancel; 590 return error;
591 error = xfs_defer_finish(&args->trans); 591 error = xfs_defer_finish(&args->trans);
592 if (error) 592 if (error)
593 return error; 593 return error;
@@ -675,7 +675,7 @@ xfs_attr_leaf_addname(
675 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); 675 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
676 /* bp is gone due to xfs_da_shrink_inode */ 676 /* bp is gone due to xfs_da_shrink_inode */
677 if (error) 677 if (error)
678 goto out_defer_cancel; 678 return error;
679 error = xfs_defer_finish(&args->trans); 679 error = xfs_defer_finish(&args->trans);
680 if (error) 680 if (error)
681 return error; 681 return error;
@@ -693,9 +693,6 @@ xfs_attr_leaf_addname(
693 error = xfs_attr3_leaf_clearflag(args); 693 error = xfs_attr3_leaf_clearflag(args);
694 } 694 }
695 return error; 695 return error;
696out_defer_cancel:
697 xfs_defer_cancel(args->trans);
698 return error;
699} 696}
700 697
701/* 698/*
@@ -738,15 +735,12 @@ xfs_attr_leaf_removename(
738 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); 735 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
739 /* bp is gone due to xfs_da_shrink_inode */ 736 /* bp is gone due to xfs_da_shrink_inode */
740 if (error) 737 if (error)
741 goto out_defer_cancel; 738 return error;
742 error = xfs_defer_finish(&args->trans); 739 error = xfs_defer_finish(&args->trans);
743 if (error) 740 if (error)
744 return error; 741 return error;
745 } 742 }
746 return 0; 743 return 0;
747out_defer_cancel:
748 xfs_defer_cancel(args->trans);
749 return error;
750} 744}
751 745
752/* 746/*
@@ -864,7 +858,7 @@ restart:
864 state = NULL; 858 state = NULL;
865 error = xfs_attr3_leaf_to_node(args); 859 error = xfs_attr3_leaf_to_node(args);
866 if (error) 860 if (error)
867 goto out_defer_cancel; 861 goto out;
868 error = xfs_defer_finish(&args->trans); 862 error = xfs_defer_finish(&args->trans);
869 if (error) 863 if (error)
870 goto out; 864 goto out;
@@ -888,7 +882,7 @@ restart:
888 */ 882 */
889 error = xfs_da3_split(state); 883 error = xfs_da3_split(state);
890 if (error) 884 if (error)
891 goto out_defer_cancel; 885 goto out;
892 error = xfs_defer_finish(&args->trans); 886 error = xfs_defer_finish(&args->trans);
893 if (error) 887 if (error)
894 goto out; 888 goto out;
@@ -984,7 +978,7 @@ restart:
984 if (retval && (state->path.active > 1)) { 978 if (retval && (state->path.active > 1)) {
985 error = xfs_da3_join(state); 979 error = xfs_da3_join(state);
986 if (error) 980 if (error)
987 goto out_defer_cancel; 981 goto out;
988 error = xfs_defer_finish(&args->trans); 982 error = xfs_defer_finish(&args->trans);
989 if (error) 983 if (error)
990 goto out; 984 goto out;
@@ -1013,9 +1007,6 @@ out:
1013 if (error) 1007 if (error)
1014 return error; 1008 return error;
1015 return retval; 1009 return retval;
1016out_defer_cancel:
1017 xfs_defer_cancel(args->trans);
1018 goto out;
1019} 1010}
1020 1011
1021/* 1012/*
@@ -1107,7 +1098,7 @@ xfs_attr_node_removename(
1107 if (retval && (state->path.active > 1)) { 1098 if (retval && (state->path.active > 1)) {
1108 error = xfs_da3_join(state); 1099 error = xfs_da3_join(state);
1109 if (error) 1100 if (error)
1110 goto out_defer_cancel; 1101 goto out;
1111 error = xfs_defer_finish(&args->trans); 1102 error = xfs_defer_finish(&args->trans);
1112 if (error) 1103 if (error)
1113 goto out; 1104 goto out;
@@ -1138,7 +1129,7 @@ xfs_attr_node_removename(
1138 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); 1129 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
1139 /* bp is gone due to xfs_da_shrink_inode */ 1130 /* bp is gone due to xfs_da_shrink_inode */
1140 if (error) 1131 if (error)
1141 goto out_defer_cancel; 1132 goto out;
1142 error = xfs_defer_finish(&args->trans); 1133 error = xfs_defer_finish(&args->trans);
1143 if (error) 1134 if (error)
1144 goto out; 1135 goto out;
@@ -1150,9 +1141,6 @@ xfs_attr_node_removename(
1150out: 1141out:
1151 xfs_da_state_free(state); 1142 xfs_da_state_free(state);
1152 return error; 1143 return error;
1153out_defer_cancel:
1154 xfs_defer_cancel(args->trans);
1155 goto out;
1156} 1144}
1157 1145
1158/* 1146/*
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index af094063e402..d89363c6b523 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -485,7 +485,7 @@ xfs_attr_rmtval_set(
485 blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map, 485 blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map,
486 &nmap); 486 &nmap);
487 if (error) 487 if (error)
488 goto out_defer_cancel; 488 return error;
489 error = xfs_defer_finish(&args->trans); 489 error = xfs_defer_finish(&args->trans);
490 if (error) 490 if (error)
491 return error; 491 return error;
@@ -553,9 +553,6 @@ xfs_attr_rmtval_set(
553 } 553 }
554 ASSERT(valuelen == 0); 554 ASSERT(valuelen == 0);
555 return 0; 555 return 0;
556out_defer_cancel:
557 xfs_defer_cancel(args->trans);
558 return error;
559} 556}
560 557
561/* 558/*
@@ -625,7 +622,7 @@ xfs_attr_rmtval_remove(
625 error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, 622 error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
626 XFS_BMAPI_ATTRFORK, 1, &done); 623 XFS_BMAPI_ATTRFORK, 1, &done);
627 if (error) 624 if (error)
628 goto out_defer_cancel; 625 return error;
629 error = xfs_defer_finish(&args->trans); 626 error = xfs_defer_finish(&args->trans);
630 if (error) 627 if (error)
631 return error; 628 return error;
@@ -638,7 +635,4 @@ xfs_attr_rmtval_remove(
638 return error; 635 return error;
639 } 636 }
640 return 0; 637 return 0;
641out_defer_cancel:
642 xfs_defer_cancel(args->trans);
643 return error;
644} 638}
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index addbd74ecd8e..ae3cc393724f 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1584,7 +1584,7 @@ xfs_swap_extent_rmap(
1584 tirec.br_blockcount, &irec, 1584 tirec.br_blockcount, &irec,
1585 &nimaps, 0); 1585 &nimaps, 0);
1586 if (error) 1586 if (error)
1587 goto out_defer; 1587 goto out;
1588 ASSERT(nimaps == 1); 1588 ASSERT(nimaps == 1);
1589 ASSERT(tirec.br_startoff == irec.br_startoff); 1589 ASSERT(tirec.br_startoff == irec.br_startoff);
1590 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec); 1590 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec);
@@ -1599,22 +1599,22 @@ xfs_swap_extent_rmap(
1599 /* Remove the mapping from the donor file. */ 1599 /* Remove the mapping from the donor file. */
1600 error = xfs_bmap_unmap_extent(tp, tip, &uirec); 1600 error = xfs_bmap_unmap_extent(tp, tip, &uirec);
1601 if (error) 1601 if (error)
1602 goto out_defer; 1602 goto out;
1603 1603
1604 /* Remove the mapping from the source file. */ 1604 /* Remove the mapping from the source file. */
1605 error = xfs_bmap_unmap_extent(tp, ip, &irec); 1605 error = xfs_bmap_unmap_extent(tp, ip, &irec);
1606 if (error) 1606 if (error)
1607 goto out_defer; 1607 goto out;
1608 1608
1609 /* Map the donor file's blocks into the source file. */ 1609 /* Map the donor file's blocks into the source file. */
1610 error = xfs_bmap_map_extent(tp, ip, &uirec); 1610 error = xfs_bmap_map_extent(tp, ip, &uirec);
1611 if (error) 1611 if (error)
1612 goto out_defer; 1612 goto out;
1613 1613
1614 /* Map the source file's blocks into the donor file. */ 1614 /* Map the source file's blocks into the donor file. */
1615 error = xfs_bmap_map_extent(tp, tip, &irec); 1615 error = xfs_bmap_map_extent(tp, tip, &irec);
1616 if (error) 1616 if (error)
1617 goto out_defer; 1617 goto out;
1618 1618
1619 error = xfs_defer_finish(tpp); 1619 error = xfs_defer_finish(tpp);
1620 tp = *tpp; 1620 tp = *tpp;
@@ -1636,8 +1636,6 @@ xfs_swap_extent_rmap(
1636 tip->i_d.di_flags2 = tip_flags2; 1636 tip->i_d.di_flags2 = tip_flags2;
1637 return 0; 1637 return 0;
1638 1638
1639out_defer:
1640 xfs_defer_cancel(tp);
1641out: 1639out:
1642 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_); 1640 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_);
1643 tip->i_d.di_flags2 = tip_flags2; 1641 tip->i_d.di_flags2 = tip_flags2;
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index d957a46dc1cb..05db9540e459 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1563,7 +1563,7 @@ xfs_itruncate_extents_flags(
1563 error = xfs_bunmapi(tp, ip, first_unmap_block, unmap_len, flags, 1563 error = xfs_bunmapi(tp, ip, first_unmap_block, unmap_len, flags,
1564 XFS_ITRUNC_MAX_EXTENTS, &done); 1564 XFS_ITRUNC_MAX_EXTENTS, &done);
1565 if (error) 1565 if (error)
1566 goto out_bmap_cancel; 1566 goto out;
1567 1567
1568 /* 1568 /*
1569 * Duplicate the transaction that has the permanent 1569 * Duplicate the transaction that has the permanent
@@ -1599,14 +1599,6 @@ xfs_itruncate_extents_flags(
1599out: 1599out:
1600 *tpp = tp; 1600 *tpp = tp;
1601 return error; 1601 return error;
1602out_bmap_cancel:
1603 /*
1604 * If the bunmapi call encounters an error, return to the caller where
1605 * the transaction can be properly aborted. We just need to make sure
1606 * we're not holding any resources that we were not when we came in.
1607 */
1608 xfs_defer_cancel(tp);
1609 goto out;
1610} 1602}
1611 1603
1612int 1604int