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>
This commit is contained in:
parent
183caa3c86
commit
cb0b476ab1
|
@ -59,7 +59,7 @@ asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
|
||||||
case Q_GETQUOTA:
|
case Q_GETQUOTA:
|
||||||
dqblk = compat_alloc_user_space(sizeof(struct if_dqblk));
|
dqblk = compat_alloc_user_space(sizeof(struct if_dqblk));
|
||||||
compat_dqblk = addr;
|
compat_dqblk = addr;
|
||||||
ret = sys_quotactl(cmd, special, id, dqblk);
|
ret = kernel_quotactl(cmd, special, id, dqblk);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
if (copy_in_user(compat_dqblk, dqblk, sizeof(*compat_dqblk)) ||
|
if (copy_in_user(compat_dqblk, dqblk, sizeof(*compat_dqblk)) ||
|
||||||
|
@ -75,12 +75,12 @@ asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
|
||||||
get_user(data, &compat_dqblk->dqb_valid) ||
|
get_user(data, &compat_dqblk->dqb_valid) ||
|
||||||
put_user(data, &dqblk->dqb_valid))
|
put_user(data, &dqblk->dqb_valid))
|
||||||
break;
|
break;
|
||||||
ret = sys_quotactl(cmd, special, id, dqblk);
|
ret = kernel_quotactl(cmd, special, id, dqblk);
|
||||||
break;
|
break;
|
||||||
case Q_XGETQSTAT:
|
case Q_XGETQSTAT:
|
||||||
fsqstat = compat_alloc_user_space(sizeof(struct fs_quota_stat));
|
fsqstat = compat_alloc_user_space(sizeof(struct fs_quota_stat));
|
||||||
compat_fsqstat = addr;
|
compat_fsqstat = addr;
|
||||||
ret = sys_quotactl(cmd, special, id, fsqstat);
|
ret = kernel_quotactl(cmd, special, id, fsqstat);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
|
@ -113,7 +113,7 @@ asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = sys_quotactl(cmd, special, id, addr);
|
ret = kernel_quotactl(cmd, special, id, addr);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -833,8 +833,8 @@ static struct super_block *quotactl_block(const char __user *special, int cmd)
|
||||||
* calls. Maybe we need to add the process quotas etc. in the future,
|
* calls. Maybe we need to add the process quotas etc. in the future,
|
||||||
* but we probably should use rlimits for that.
|
* but we probably should use rlimits for that.
|
||||||
*/
|
*/
|
||||||
SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
|
int kernel_quotactl(unsigned int cmd, const char __user *special,
|
||||||
qid_t, id, void __user *, addr)
|
qid_t id, void __user *addr)
|
||||||
{
|
{
|
||||||
uint cmds, type;
|
uint cmds, type;
|
||||||
struct super_block *sb = NULL;
|
struct super_block *sb = NULL;
|
||||||
|
@ -885,3 +885,9 @@ out:
|
||||||
path_put(pathp);
|
path_put(pathp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
|
||||||
|
qid_t, id, void __user *, addr)
|
||||||
|
{
|
||||||
|
return kernel_quotactl(cmd, special, id, addr);
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,9 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
|
||||||
(ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid));
|
(ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int kernel_quotactl(unsigned int cmd, const char __user *special,
|
||||||
|
qid_t id, void __user *addr);
|
||||||
|
|
||||||
#if defined(CONFIG_QUOTA)
|
#if defined(CONFIG_QUOTA)
|
||||||
|
|
||||||
#define quota_error(sb, fmt, args...) \
|
#define quota_error(sb, fmt, args...) \
|
||||||
|
|
Loading…
Reference in New Issue