aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/xattr.c
diff options
context:
space:
mode:
authorErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>2017-08-30 08:26:30 -0400
committerBob Peterson <rpeterso@redhat.com>2017-08-31 08:43:03 -0400
commit54aae14beee6a6e9f72358f1873b3e497029c41d (patch)
tree20fc8689454f86a7a9984df602c1ec8bc033dc85 /fs/gfs2/xattr.c
parentc4a9d1892f1ce6fe040b717b68bd21e689cc2410 (diff)
gfs2: don't return ENODATA in __gfs2_xattr_set unless replacing
The function __gfs2_xattr_set() will return -ENODATA when called to remove a xattr that does not exist. The result is that setfacl will show an exit status of 1 when called to set only a file's mode bits (on a file with no ACLs), despite succeeding. A "No data available" error will be printed as well. To fix this return 0 instead, except when the XATTR_REPLACE flag is set, in which case -ENODATA is appropriate. This is consistent with how most other xattr setting functions work, in other filesystems. Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/xattr.c')
-rw-r--r--fs/gfs2/xattr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index cf694de4991a..ea09e41dbb49 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -1210,8 +1210,12 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
1210 if (namel > GFS2_EA_MAX_NAME_LEN) 1210 if (namel > GFS2_EA_MAX_NAME_LEN)
1211 return -ERANGE; 1211 return -ERANGE;
1212 1212
1213 if (value == NULL) 1213 if (value == NULL) {
1214 return gfs2_xattr_remove(ip, type, name); 1214 error = gfs2_xattr_remove(ip, type, name);
1215 if (error == -ENODATA && !(flags & XATTR_REPLACE))
1216 error = 0;
1217 return error;
1218 }
1215 1219
1216 if (ea_check_size(sdp, namel, size)) 1220 if (ea_check_size(sdp, namel, size))
1217 return -ERANGE; 1221 return -ERANGE;