summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/libxfs/xfs_attr.c')
-rw-r--r--fs/xfs/libxfs/xfs_attr.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index bcf8748cb1a3..e8b4317da830 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -1066,19 +1066,14 @@ xfs_attr_shortform_addname(
struct xfs_da_args *args)
{
int newsize, forkoff;
- int error;
trace_xfs_attr_sf_addname(args);
- error = xfs_attr_shortform_lookup(args);
- switch (error) {
- case -ENOATTR:
- if (args->op_flags & XFS_DA_OP_REPLACE)
- return error;
- break;
- case -EEXIST:
+ if (xfs_attr_sf_findname(args)) {
+ int error;
+
if (!(args->op_flags & XFS_DA_OP_REPLACE))
- return error;
+ return -EEXIST;
error = xfs_attr_sf_removename(args);
if (error)
@@ -1091,11 +1086,9 @@ xfs_attr_shortform_addname(
* around.
*/
args->op_flags &= ~XFS_DA_OP_REPLACE;
- break;
- case 0:
- break;
- default:
- return error;
+ } else {
+ if (args->op_flags & XFS_DA_OP_REPLACE)
+ return -ENOATTR;
}
if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||