Commit deed9512 authored by Allison Collins's avatar Allison Collins Committed by Darrick J. Wong

xfs: Check for -ENOATTR or -EEXIST

Delayed operations cannot return error codes.  So we must check for
these conditions first before starting set or remove operations
Signed-off-by: default avatarAllison Collins <allison.henderson@oracle.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Acked-by: default avatarDave Chinner <dchinner@redhat.com>
parent 07120f1a
...@@ -404,6 +404,15 @@ xfs_attr_set( ...@@ -404,6 +404,15 @@ xfs_attr_set(
args->total, 0, quota_flags); args->total, 0, quota_flags);
if (error) if (error)
goto out_trans_cancel; goto out_trans_cancel;
error = xfs_has_attr(args);
if (error == -EEXIST && (args->attr_flags & XATTR_CREATE))
goto out_trans_cancel;
if (error == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
goto out_trans_cancel;
if (error != -ENOATTR && error != -EEXIST)
goto out_trans_cancel;
error = xfs_attr_set_args(args); error = xfs_attr_set_args(args);
if (error) if (error)
goto out_trans_cancel; goto out_trans_cancel;
...@@ -411,6 +420,10 @@ xfs_attr_set( ...@@ -411,6 +420,10 @@ xfs_attr_set(
if (!args->trans) if (!args->trans)
goto out_unlock; goto out_unlock;
} else { } else {
error = xfs_has_attr(args);
if (error != -EEXIST)
goto out_trans_cancel;
error = xfs_attr_remove_args(args); error = xfs_attr_remove_args(args);
if (error) if (error)
goto out_trans_cancel; goto out_trans_cancel;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment