mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-04 13:21:45 +00:00
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>
This commit is contained in:
parent
c4a9d1892f
commit
54aae14bee
1 changed files with 6 additions and 2 deletions
|
@ -1210,8 +1210,12 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
|
||||||
if (namel > GFS2_EA_MAX_NAME_LEN)
|
if (namel > GFS2_EA_MAX_NAME_LEN)
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
||||||
if (value == NULL)
|
if (value == NULL) {
|
||||||
return gfs2_xattr_remove(ip, type, name);
|
error = gfs2_xattr_remove(ip, type, name);
|
||||||
|
if (error == -ENODATA && !(flags & XATTR_REPLACE))
|
||||||
|
error = 0;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
if (ea_check_size(sdp, namel, size))
|
if (ea_check_size(sdp, namel, size))
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue