diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 86f482e5798f..1fc1f06277da 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -187,7 +187,7 @@ xfs_attr_calc_size( | |||
187 | * Out of line attribute, cannot double split, but | 187 | * Out of line attribute, cannot double split, but |
188 | * make room for the attribute value itself. | 188 | * make room for the attribute value itself. |
189 | */ | 189 | */ |
190 | uint dblocks = XFS_B_TO_FSB(mp, args->valuelen); | 190 | uint dblocks = xfs_attr3_rmt_blocks(mp, args->valuelen); |
191 | nblks += dblocks; | 191 | nblks += dblocks; |
192 | nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK); | 192 | nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK); |
193 | } | 193 | } |
@@ -604,11 +604,22 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
604 | 604 | ||
605 | trace_xfs_attr_leaf_replace(args); | 605 | trace_xfs_attr_leaf_replace(args); |
606 | 606 | ||
607 | /* save the attribute state for later removal*/ | ||
607 | args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */ | 608 | args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */ |
608 | args->blkno2 = args->blkno; /* set 2nd entry info*/ | 609 | args->blkno2 = args->blkno; /* set 2nd entry info*/ |
609 | args->index2 = args->index; | 610 | args->index2 = args->index; |
610 | args->rmtblkno2 = args->rmtblkno; | 611 | args->rmtblkno2 = args->rmtblkno; |
611 | args->rmtblkcnt2 = args->rmtblkcnt; | 612 | args->rmtblkcnt2 = args->rmtblkcnt; |
613 | args->rmtvaluelen2 = args->rmtvaluelen; | ||
614 | |||
615 | /* | ||
616 | * clear the remote attr state now that it is saved so that the | ||
617 | * values reflect the state of the attribute we are about to | ||
618 | * add, not the attribute we just found and will remove later. | ||
619 | */ | ||
620 | args->rmtblkno = 0; | ||
621 | args->rmtblkcnt = 0; | ||
622 | args->rmtvaluelen = 0; | ||
612 | } | 623 | } |
613 | 624 | ||
614 | /* | 625 | /* |
@@ -700,6 +711,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
700 | args->blkno = args->blkno2; | 711 | args->blkno = args->blkno2; |
701 | args->rmtblkno = args->rmtblkno2; | 712 | args->rmtblkno = args->rmtblkno2; |
702 | args->rmtblkcnt = args->rmtblkcnt2; | 713 | args->rmtblkcnt = args->rmtblkcnt2; |
714 | args->rmtvaluelen = args->rmtvaluelen2; | ||
703 | if (args->rmtblkno) { | 715 | if (args->rmtblkno) { |
704 | error = xfs_attr_rmtval_remove(args); | 716 | error = xfs_attr_rmtval_remove(args); |
705 | if (error) | 717 | if (error) |
@@ -905,13 +917,22 @@ restart: | |||
905 | 917 | ||
906 | trace_xfs_attr_node_replace(args); | 918 | trace_xfs_attr_node_replace(args); |
907 | 919 | ||
920 | /* save the attribute state for later removal*/ | ||
908 | args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */ | 921 | args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */ |
909 | args->blkno2 = args->blkno; /* set 2nd entry info*/ | 922 | args->blkno2 = args->blkno; /* set 2nd entry info*/ |
910 | args->index2 = args->index; | 923 | args->index2 = args->index; |
911 | args->rmtblkno2 = args->rmtblkno; | 924 | args->rmtblkno2 = args->rmtblkno; |
912 | args->rmtblkcnt2 = args->rmtblkcnt; | 925 | args->rmtblkcnt2 = args->rmtblkcnt; |
926 | args->rmtvaluelen2 = args->rmtvaluelen; | ||
927 | |||
928 | /* | ||
929 | * clear the remote attr state now that it is saved so that the | ||
930 | * values reflect the state of the attribute we are about to | ||
931 | * add, not the attribute we just found and will remove later. | ||
932 | */ | ||
913 | args->rmtblkno = 0; | 933 | args->rmtblkno = 0; |
914 | args->rmtblkcnt = 0; | 934 | args->rmtblkcnt = 0; |
935 | args->rmtvaluelen = 0; | ||
915 | } | 936 | } |
916 | 937 | ||
917 | retval = xfs_attr3_leaf_add(blk->bp, state->args); | 938 | retval = xfs_attr3_leaf_add(blk->bp, state->args); |
@@ -1039,6 +1060,7 @@ restart: | |||
1039 | args->blkno = args->blkno2; | 1060 | args->blkno = args->blkno2; |
1040 | args->rmtblkno = args->rmtblkno2; | 1061 | args->rmtblkno = args->rmtblkno2; |
1041 | args->rmtblkcnt = args->rmtblkcnt2; | 1062 | args->rmtblkcnt = args->rmtblkcnt2; |
1063 | args->rmtvaluelen = args->rmtvaluelen2; | ||
1042 | if (args->rmtblkno) { | 1064 | if (args->rmtblkno) { |
1043 | error = xfs_attr_rmtval_remove(args); | 1065 | error = xfs_attr_rmtval_remove(args); |
1044 | if (error) | 1066 | if (error) |