Skip to content

Commit 378b6ae

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
xfs: turn the XFS_DA_OP_REPLACE checks in xfs_attr_shortform_addname into asserts
Since commit deed951 ("xfs: Check for -ENOATTR or -EEXIST"), the high-level attr code does a lookup for any attr we're trying to set, and does the checks to handle the create vs replace cases, which thus never hit the low-level attr code. Turn the checks in xfs_attr_shortform_addname as they must never trip. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
1 parent 074aea4 commit 378b6ae

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,7 @@ xfs_attr_shortform_addname(
10721072
if (xfs_attr_sf_findname(args)) {
10731073
int error;
10741074

1075-
if (!(args->op_flags & XFS_DA_OP_REPLACE))
1076-
return -EEXIST;
1075+
ASSERT(args->op_flags & XFS_DA_OP_REPLACE);
10771076

10781077
error = xfs_attr_sf_removename(args);
10791078
if (error)
@@ -1087,8 +1086,7 @@ xfs_attr_shortform_addname(
10871086
*/
10881087
args->op_flags &= ~XFS_DA_OP_REPLACE;
10891088
} else {
1090-
if (args->op_flags & XFS_DA_OP_REPLACE)
1091-
return -ENOATTR;
1089+
ASSERT(!(args->op_flags & XFS_DA_OP_REPLACE));
10921090
}
10931091

10941092
if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||

0 commit comments

Comments
 (0)