@@ -328,13 +328,12 @@ xfs_attr_set(
328
328
*/
329
329
xfs_defer_init (args .dfops , args .firstblock );
330
330
error = xfs_attr_shortform_to_leaf (& args );
331
- if (!error )
332
- error = xfs_defer_finish (& args .trans , args .dfops , dp );
333
- if (error ) {
334
- args .trans = NULL ;
335
- xfs_defer_cancel (& dfops );
336
- goto out ;
337
- }
331
+ if (error )
332
+ goto out_defer_cancel ;
333
+ xfs_defer_ijoin (args .dfops , dp );
334
+ error = xfs_defer_finish (& args .trans , args .dfops );
335
+ if (error )
336
+ goto out_defer_cancel ;
338
337
339
338
/*
340
339
* Commit the leaf transformation. We'll need another (linked)
@@ -373,6 +372,9 @@ xfs_attr_set(
373
372
374
373
return error ;
375
374
375
+ out_defer_cancel :
376
+ xfs_defer_cancel (& dfops );
377
+ args .trans = NULL ;
376
378
out :
377
379
if (args .trans )
378
380
xfs_trans_cancel (args .trans );
@@ -593,13 +595,12 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
593
595
*/
594
596
xfs_defer_init (args -> dfops , args -> firstblock );
595
597
error = xfs_attr3_leaf_to_node (args );
596
- if (!error )
597
- error = xfs_defer_finish (& args -> trans , args -> dfops , dp );
598
- if (error ) {
599
- args -> trans = NULL ;
600
- xfs_defer_cancel (args -> dfops );
601
- return error ;
602
- }
598
+ if (error )
599
+ goto out_defer_cancel ;
600
+ xfs_defer_ijoin (args -> dfops , dp );
601
+ error = xfs_defer_finish (& args -> trans , args -> dfops );
602
+ if (error )
603
+ goto out_defer_cancel ;
603
604
604
605
/*
605
606
* Commit the current trans (including the inode) and start
@@ -684,14 +685,12 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
684
685
xfs_defer_init (args -> dfops , args -> firstblock );
685
686
error = xfs_attr3_leaf_to_shortform (bp , args , forkoff );
686
687
/* bp is gone due to xfs_da_shrink_inode */
687
- if (!error )
688
- error = xfs_defer_finish (& args -> trans ,
689
- args -> dfops , dp );
690
- if (error ) {
691
- args -> trans = NULL ;
692
- xfs_defer_cancel (args -> dfops );
693
- return error ;
694
- }
688
+ if (error )
689
+ goto out_defer_cancel ;
690
+ xfs_defer_ijoin (args -> dfops , dp );
691
+ error = xfs_defer_finish (& args -> trans , args -> dfops );
692
+ if (error )
693
+ goto out_defer_cancel ;
695
694
}
696
695
697
696
/*
@@ -706,6 +705,10 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
706
705
error = xfs_attr3_leaf_clearflag (args );
707
706
}
708
707
return error ;
708
+ out_defer_cancel :
709
+ xfs_defer_cancel (args -> dfops );
710
+ args -> trans = NULL ;
711
+ return error ;
709
712
}
710
713
711
714
/*
@@ -747,15 +750,18 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
747
750
xfs_defer_init (args -> dfops , args -> firstblock );
748
751
error = xfs_attr3_leaf_to_shortform (bp , args , forkoff );
749
752
/* bp is gone due to xfs_da_shrink_inode */
750
- if (!error )
751
- error = xfs_defer_finish (& args -> trans , args -> dfops , dp );
752
- if (error ) {
753
- args -> trans = NULL ;
754
- xfs_defer_cancel (args -> dfops );
755
- return error ;
756
- }
753
+ if (error )
754
+ goto out_defer_cancel ;
755
+ xfs_defer_ijoin (args -> dfops , dp );
756
+ error = xfs_defer_finish (& args -> trans , args -> dfops );
757
+ if (error )
758
+ goto out_defer_cancel ;
757
759
}
758
760
return 0 ;
761
+ out_defer_cancel :
762
+ xfs_defer_cancel (args -> dfops );
763
+ args -> trans = NULL ;
764
+ return error ;
759
765
}
760
766
761
767
/*
@@ -872,14 +878,12 @@ xfs_attr_node_addname(xfs_da_args_t *args)
872
878
state = NULL ;
873
879
xfs_defer_init (args -> dfops , args -> firstblock );
874
880
error = xfs_attr3_leaf_to_node (args );
875
- if (!error )
876
- error = xfs_defer_finish (& args -> trans ,
877
- args -> dfops , dp );
878
- if (error ) {
879
- args -> trans = NULL ;
880
- xfs_defer_cancel (args -> dfops );
881
- goto out ;
882
- }
881
+ if (error )
882
+ goto out_defer_cancel ;
883
+ xfs_defer_ijoin (args -> dfops , dp );
884
+ error = xfs_defer_finish (& args -> trans , args -> dfops );
885
+ if (error )
886
+ goto out_defer_cancel ;
883
887
884
888
/*
885
889
* Commit the node conversion and start the next
@@ -900,13 +904,12 @@ xfs_attr_node_addname(xfs_da_args_t *args)
900
904
*/
901
905
xfs_defer_init (args -> dfops , args -> firstblock );
902
906
error = xfs_da3_split (state );
903
- if (!error )
904
- error = xfs_defer_finish (& args -> trans , args -> dfops , dp );
905
- if (error ) {
906
- args -> trans = NULL ;
907
- xfs_defer_cancel (args -> dfops );
908
- goto out ;
909
- }
907
+ if (error )
908
+ goto out_defer_cancel ;
909
+ xfs_defer_ijoin (args -> dfops , dp );
910
+ error = xfs_defer_finish (& args -> trans , args -> dfops );
911
+ if (error )
912
+ goto out_defer_cancel ;
910
913
} else {
911
914
/*
912
915
* Addition succeeded, update Btree hashvals.
@@ -999,14 +1002,12 @@ xfs_attr_node_addname(xfs_da_args_t *args)
999
1002
if (retval && (state -> path .active > 1 )) {
1000
1003
xfs_defer_init (args -> dfops , args -> firstblock );
1001
1004
error = xfs_da3_join (state );
1002
- if (!error )
1003
- error = xfs_defer_finish (& args -> trans ,
1004
- args -> dfops , dp );
1005
- if (error ) {
1006
- args -> trans = NULL ;
1007
- xfs_defer_cancel (args -> dfops );
1008
- goto out ;
1009
- }
1005
+ if (error )
1006
+ goto out_defer_cancel ;
1007
+ xfs_defer_ijoin (args -> dfops , dp );
1008
+ error = xfs_defer_finish (& args -> trans , args -> dfops );
1009
+ if (error )
1010
+ goto out_defer_cancel ;
1010
1011
}
1011
1012
1012
1013
/*
@@ -1032,6 +1033,10 @@ xfs_attr_node_addname(xfs_da_args_t *args)
1032
1033
if (error )
1033
1034
return error ;
1034
1035
return retval ;
1036
+ out_defer_cancel :
1037
+ xfs_defer_cancel (args -> dfops );
1038
+ args -> trans = NULL ;
1039
+ goto out ;
1035
1040
}
1036
1041
1037
1042
/*
@@ -1122,13 +1127,12 @@ xfs_attr_node_removename(xfs_da_args_t *args)
1122
1127
if (retval && (state -> path .active > 1 )) {
1123
1128
xfs_defer_init (args -> dfops , args -> firstblock );
1124
1129
error = xfs_da3_join (state );
1125
- if (!error )
1126
- error = xfs_defer_finish (& args -> trans , args -> dfops , dp );
1127
- if (error ) {
1128
- args -> trans = NULL ;
1129
- xfs_defer_cancel (args -> dfops );
1130
- goto out ;
1131
- }
1130
+ if (error )
1131
+ goto out_defer_cancel ;
1132
+ xfs_defer_ijoin (args -> dfops , dp );
1133
+ error = xfs_defer_finish (& args -> trans , args -> dfops );
1134
+ if (error )
1135
+ goto out_defer_cancel ;
1132
1136
/*
1133
1137
* Commit the Btree join operation and start a new trans.
1134
1138
*/
@@ -1156,14 +1160,12 @@ xfs_attr_node_removename(xfs_da_args_t *args)
1156
1160
xfs_defer_init (args -> dfops , args -> firstblock );
1157
1161
error = xfs_attr3_leaf_to_shortform (bp , args , forkoff );
1158
1162
/* bp is gone due to xfs_da_shrink_inode */
1159
- if (!error )
1160
- error = xfs_defer_finish (& args -> trans ,
1161
- args -> dfops , dp );
1162
- if (error ) {
1163
- args -> trans = NULL ;
1164
- xfs_defer_cancel (args -> dfops );
1165
- goto out ;
1166
- }
1163
+ if (error )
1164
+ goto out_defer_cancel ;
1165
+ xfs_defer_ijoin (args -> dfops , dp );
1166
+ error = xfs_defer_finish (& args -> trans , args -> dfops );
1167
+ if (error )
1168
+ goto out_defer_cancel ;
1167
1169
} else
1168
1170
xfs_trans_brelse (args -> trans , bp );
1169
1171
}
@@ -1172,6 +1174,10 @@ xfs_attr_node_removename(xfs_da_args_t *args)
1172
1174
out :
1173
1175
xfs_da_state_free (state );
1174
1176
return error ;
1177
+ out_defer_cancel :
1178
+ xfs_defer_cancel (args -> dfops );
1179
+ args -> trans = NULL ;
1180
+ goto out ;
1175
1181
}
1176
1182
1177
1183
/*
0 commit comments