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
This commit is contained in:
Luis Henriques 2021-03-26 17:46:45 +00:00 committed by Tony Hutter
parent 332cd2e313
commit 5072f37419
1 changed files with 1 additions and 1 deletions

View File

@ -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) || if ((fchange(ioctl_flags, zfs_flags, FS_IMMUTABLE_FL, ZFS_IMMUTABLE) ||
fchange(ioctl_flags, zfs_flags, FS_APPEND_FL, ZFS_APPENDONLY)) && fchange(ioctl_flags, zfs_flags, FS_APPEND_FL, ZFS_APPENDONLY)) &&
!capable(CAP_LINUX_IMMUTABLE)) !capable(CAP_LINUX_IMMUTABLE))
return (-EACCES); return (-EPERM);
if (!zpl_inode_owner_or_capable(kcred->user_ns, ip)) if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
return (-EACCES); return (-EACCES);