From: Allison Collins Date: Tue, 15 Sep 2020 19:59:36 +0000 (-0400) Subject: xfs: Check for -ENOATTR or -EEXIST X-Git-Tag: v5.9.0-rc0~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=36b8f99d2a4b15c332f05017e1439e6003215290;p=thirdparty%2Fxfsprogs-dev.git xfs: Check for -ENOATTR or -EEXIST Source kernel commit: deed9512872d094ad1eae4abd0ff1c674df251d5 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 Reviewed-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Darrick J. Wong Acked-by: Dave Chinner Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 5267ee72e..3d71c275a 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -404,6 +404,15 @@ xfs_attr_set( args->total, 0, quota_flags); if (error) 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); if (error) goto out_trans_cancel; @@ -411,6 +420,10 @@ xfs_attr_set( if (!args->trans) goto out_unlock; } else { + error = xfs_has_attr(args); + if (error != -EEXIST) + goto out_trans_cancel; + error = xfs_attr_remove_args(args); if (error) goto out_trans_cancel;