Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs/quota: add kernel_quotactl() helper; remove in-kernel call to syscall

Using the fs-internal kernel_quotactl() helper allows us to get rid of
the fs-internal call to the sys_quotactl() syscall.

This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

+15 -6
+4 -4
fs/quota/compat.c
··· 59 59 case Q_GETQUOTA: 60 60 dqblk = compat_alloc_user_space(sizeof(struct if_dqblk)); 61 61 compat_dqblk = addr; 62 - ret = sys_quotactl(cmd, special, id, dqblk); 62 + ret = kernel_quotactl(cmd, special, id, dqblk); 63 63 if (ret) 64 64 break; 65 65 if (copy_in_user(compat_dqblk, dqblk, sizeof(*compat_dqblk)) || ··· 75 75 get_user(data, &compat_dqblk->dqb_valid) || 76 76 put_user(data, &dqblk->dqb_valid)) 77 77 break; 78 - ret = sys_quotactl(cmd, special, id, dqblk); 78 + ret = kernel_quotactl(cmd, special, id, dqblk); 79 79 break; 80 80 case Q_XGETQSTAT: 81 81 fsqstat = compat_alloc_user_space(sizeof(struct fs_quota_stat)); 82 82 compat_fsqstat = addr; 83 - ret = sys_quotactl(cmd, special, id, fsqstat); 83 + ret = kernel_quotactl(cmd, special, id, fsqstat); 84 84 if (ret) 85 85 break; 86 86 ret = -EFAULT; ··· 113 113 ret = 0; 114 114 break; 115 115 default: 116 - ret = sys_quotactl(cmd, special, id, addr); 116 + ret = kernel_quotactl(cmd, special, id, addr); 117 117 } 118 118 return ret; 119 119 }
+8 -2
fs/quota/quota.c
··· 833 833 * calls. Maybe we need to add the process quotas etc. in the future, 834 834 * but we probably should use rlimits for that. 835 835 */ 836 - SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, 837 - qid_t, id, void __user *, addr) 836 + int kernel_quotactl(unsigned int cmd, const char __user *special, 837 + qid_t id, void __user *addr) 838 838 { 839 839 uint cmds, type; 840 840 struct super_block *sb = NULL; ··· 884 884 if (pathp && !IS_ERR(pathp)) 885 885 path_put(pathp); 886 886 return ret; 887 + } 888 + 889 + SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, 890 + qid_t, id, void __user *, addr) 891 + { 892 + return kernel_quotactl(cmd, special, id, addr); 887 893 }
+3
include/linux/quotaops.h
··· 27 27 (ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid)); 28 28 } 29 29 30 + int kernel_quotactl(unsigned int cmd, const char __user *special, 31 + qid_t id, void __user *addr); 32 + 30 33 #if defined(CONFIG_QUOTA) 31 34 32 35 #define quota_error(sb, fmt, args...) \