summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Henriques <73643340+lumigch@users.noreply.github.com>2021-03-26 17:46:45 +0000
committerTony Hutter <hutter2@llnl.gov>2021-06-23 13:22:15 -0700
commit5072f37419e9665091cb10e6a0dc732b22151dca (patch)
tree1715a6bd60dd7b278b2be7187b7d26d5cfd58d55
parent332cd2e313f65769bedf127d16d5d259db756e34 (diff)
Fix error code on __zpl_ioctl_setflags()
Other (all?) Linux filesystems seem to return -EPERM instead of -EACCESS when trying to set FS_APPEND_FL or FS_IMMUTABLE_FL without the CAP_LINUX_IMMUTABLE capability. This was detected by generic/545 test in the fstest suite. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Luis Henriques <henrix@camandro.org> Closes #11791
-rw-r--r--module/os/linux/zfs/zpl_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c
index e20c1dd41..1447525bc 100644
--- a/module/os/linux/zfs/zpl_file.c
+++ b/module/os/linux/zfs/zpl_file.c
@@ -864,7 +864,7 @@ __zpl_ioctl_setflags(struct inode *ip, uint32_t ioctl_flags, xvattr_t *xva)
if ((fchange(ioctl_flags, zfs_flags, FS_IMMUTABLE_FL, ZFS_IMMUTABLE) ||
fchange(ioctl_flags, zfs_flags, FS_APPEND_FL, ZFS_APPENDONLY)) &&
!capable(CAP_LINUX_IMMUTABLE))
- return (-EACCES);
+ return (-EPERM);
if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
return (-EACCES);