Skip to content

Commit deed951

Browse files
allisonhendersondjwong
authored andcommitted
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: Allison Collins <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Reviewed-by: Brian Foster <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]> Acked-by: Dave Chinner <[email protected]>
1 parent 07120f1 commit deed951

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,26 @@ xfs_attr_set(
404404
args->total, 0, quota_flags);
405405
if (error)
406406
goto out_trans_cancel;
407+
408+
error = xfs_has_attr(args);
409+
if (error == -EEXIST && (args->attr_flags & XATTR_CREATE))
410+
goto out_trans_cancel;
411+
if (error == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
412+
goto out_trans_cancel;
413+
if (error != -ENOATTR && error != -EEXIST)
414+
goto out_trans_cancel;
415+
407416
error = xfs_attr_set_args(args);
408417
if (error)
409418
goto out_trans_cancel;
410419
/* shortform attribute has already been committed */
411420
if (!args->trans)
412421
goto out_unlock;
413422
} else {
423+
error = xfs_has_attr(args);
424+
if (error != -EEXIST)
425+
goto out_trans_cancel;
426+
414427
error = xfs_attr_remove_args(args);
415428
if (error)
416429
goto out_trans_cancel;

0 commit comments

Comments
 (0)