@@ -695,68 +695,71 @@ xfs_attr_leaf_addname(
695
695
return error ;
696
696
}
697
697
698
- /*
699
- * If this is an atomic rename operation, we must "flip" the
700
- * incomplete flags on the "new" and "old" attribute/value pairs
701
- * so that one disappears and one appears atomically. Then we
702
- * must remove the "old" attribute/value pair.
703
- */
704
- if (args -> op_flags & XFS_DA_OP_RENAME ) {
698
+ if (!(args -> op_flags & XFS_DA_OP_RENAME )) {
705
699
/*
706
- * In a separate transaction, set the incomplete flag on the
707
- * "old" attr and clear the incomplete flag on the "new" attr.
708
- */
709
- error = xfs_attr3_leaf_flipflags (args );
710
- if (error )
711
- return error ;
712
- /*
713
- * Commit the flag value change and start the next trans in
714
- * series.
700
+ * Added a "remote" value, just clear the incomplete flag.
715
701
*/
716
- error = xfs_trans_roll_inode (& args -> trans , args -> dp );
717
- if (error )
718
- return error ;
702
+ if (args -> rmtblkno > 0 )
703
+ error = xfs_attr3_leaf_clearflag (args );
719
704
720
- /*
721
- * Dismantle the "old" attribute/value pair by removing
722
- * a "remote" value (if it exists).
723
- */
724
- xfs_attr_restore_rmt_blk (args );
705
+ return error ;
706
+ }
725
707
726
- if (args -> rmtblkno ) {
727
- error = xfs_attr_rmtval_invalidate (args );
728
- if (error )
729
- return error ;
708
+ /*
709
+ * If this is an atomic rename operation, we must "flip" the incomplete
710
+ * flags on the "new" and "old" attribute/value pairs so that one
711
+ * disappears and one appears atomically. Then we must remove the "old"
712
+ * attribute/value pair.
713
+ *
714
+ * In a separate transaction, set the incomplete flag on the "old" attr
715
+ * and clear the incomplete flag on the "new" attr.
716
+ */
730
717
731
- error = xfs_attr_rmtval_remove (args );
732
- if (error )
733
- return error ;
734
- }
718
+ error = xfs_attr3_leaf_flipflags (args );
719
+ if (error )
720
+ return error ;
721
+ /*
722
+ * Commit the flag value change and start the next trans in series.
723
+ */
724
+ error = xfs_trans_roll_inode (& args -> trans , args -> dp );
725
+ if (error )
726
+ return error ;
735
727
736
- /*
737
- * Read in the block containing the "old" attr, then
738
- * remove the "old" attr from that block (neat, huh!)
739
- */
740
- error = xfs_attr3_leaf_read (args -> trans , args -> dp , args -> blkno ,
741
- & bp );
728
+ /*
729
+ * Dismantle the "old" attribute/value pair by removing a "remote" value
730
+ * (if it exists).
731
+ */
732
+ xfs_attr_restore_rmt_blk (args );
733
+
734
+ if (args -> rmtblkno ) {
735
+ error = xfs_attr_rmtval_invalidate (args );
742
736
if (error )
743
737
return error ;
744
738
745
- xfs_attr3_leaf_remove (bp , args );
746
-
747
- /*
748
- * If the result is small enough, shrink it all into the inode.
749
- */
750
- forkoff = xfs_attr_shortform_allfit (bp , dp );
751
- if (forkoff )
752
- error = xfs_attr3_leaf_to_shortform (bp , args , forkoff );
753
- /* bp is gone due to xfs_da_shrink_inode */
754
- } else if (args -> rmtblkno > 0 ) {
755
- /*
756
- * Added a "remote" value, just clear the incomplete flag.
757
- */
758
- error = xfs_attr3_leaf_clearflag (args );
739
+ error = xfs_attr_rmtval_remove (args );
740
+ if (error )
741
+ return error ;
759
742
}
743
+
744
+ /*
745
+ * Read in the block containing the "old" attr, then remove the "old"
746
+ * attr from that block (neat, huh!)
747
+ */
748
+ error = xfs_attr3_leaf_read (args -> trans , args -> dp , args -> blkno ,
749
+ & bp );
750
+ if (error )
751
+ return error ;
752
+
753
+ xfs_attr3_leaf_remove (bp , args );
754
+
755
+ /*
756
+ * If the result is small enough, shrink it all into the inode.
757
+ */
758
+ forkoff = xfs_attr_shortform_allfit (bp , dp );
759
+ if (forkoff )
760
+ error = xfs_attr3_leaf_to_shortform (bp , args , forkoff );
761
+ /* bp is gone due to xfs_da_shrink_inode */
762
+
760
763
return error ;
761
764
}
762
765
0 commit comments