From 2037edbdaa80f49dd83c82d283d269c6fa3f95d7 Mon Sep 17 00:00:00 2001 From: Luis Henriques <73643340+lumigch@users.noreply.github.com> Date: Fri, 26 Mar 2021 17:46:45 +0000 Subject: [PATCH] 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 Signed-off-by: Luis Henriques Closes #11791 --- module/os/linux/zfs/zpl_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c index ea6993ffa4b0..d042783da1b2 100644 --- a/module/os/linux/zfs/zpl_file.c +++ b/module/os/linux/zfs/zpl_file.c @@ -867,7 +867,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);