Message ID | 20200917082236.2518236-6-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/5] nfs: simplify nfs4_parse_monolithic | expand |
On Thu, Sep 17, 2020 at 10:22:36AM +0200, Christoph Hellwig wrote: > There are only two callers left, one of which is is in the alpha-specific > OSF/1 compat code. Just open code it in both. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > arch/alpha/kernel/osf_sys.c | 7 ++++++- > fs/namespace.c | 25 ++++++++----------------- > include/linux/fs.h | 2 -- > 3 files changed, 14 insertions(+), 20 deletions(-) > > diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c > index 5fd155b13503b5..8acd5101097576 100644 > --- a/arch/alpha/kernel/osf_sys.c > +++ b/arch/alpha/kernel/osf_sys.c > @@ -434,6 +434,7 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path, ^^^^ > struct osf_mount_args tmp; > struct filename *devname; > const char *fstype; > + struct path path; ^^^^^^^^^^^^^^^^ Someone didn't bother test building this patch. arch/alpha/kernel/osf_sys.c: In function '__do_sys_osf_mount': arch/alpha/kernel/osf_sys.c:437:14: error: 'path' redeclared as different kind of symbol Guenter > int retval; > > if (copy_from_user(&tmp, args, sizeof(tmp))) > @@ -467,7 +468,11 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path, > > if (IS_ERR(devname)) > return PTR_ERR(devname); > - retval = do_mount(devname.name, dirname, fstype, flags, NULL); > + retval = user_path_at(AT_FDCWD, dirname, LOOKUP_FOLLOW, &path); > + if (!retval) { > + ret = path_mount(devname.name, &path, fstype, flags, NULL); > + path_put(&path); > + } > putname(devname); > return retval; > } > diff --git a/fs/namespace.c b/fs/namespace.c > index 12b431b61462b9..2ff373ebeaf27f 100644 > --- a/fs/namespace.c > +++ b/fs/namespace.c > @@ -3193,20 +3193,6 @@ int path_mount(const char *dev_name, struct path *path, > data_page); > } > > -long do_mount(const char *dev_name, const char __user *dir_name, > - const char *type_page, unsigned long flags, void *data_page) > -{ > - struct path path; > - int ret; > - > - ret = user_path_at(AT_FDCWD, dir_name, LOOKUP_FOLLOW, &path); > - if (ret) > - return ret; > - ret = path_mount(dev_name, &path, type_page, flags, data_page); > - path_put(&path); > - return ret; > -} > - > static struct ucounts *inc_mnt_namespaces(struct user_namespace *ns) > { > return inc_ucount(ns, current_euid(), UCOUNT_MNT_NAMESPACES); > @@ -3390,10 +3376,11 @@ EXPORT_SYMBOL(mount_subtree); > SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, > char __user *, type, unsigned long, flags, void __user *, data) > { > - int ret; > + struct path path; > char *kernel_type; > char *kernel_dev; > void *options; > + int ret; > > kernel_type = copy_mount_string(type); > ret = PTR_ERR(kernel_type); > @@ -3410,8 +3397,12 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, > if (IS_ERR(options)) > goto out_data; > > - ret = do_mount(kernel_dev, dir_name, kernel_type, flags, options); > - > + ret = user_path_at(AT_FDCWD, dir_name, LOOKUP_FOLLOW, &path); > + if (ret) > + goto out_options; > + ret = path_mount(kernel_dev, &path, kernel_type, flags, options); > + path_put(&path); > +out_options: > kfree(options); > out_data: > kfree(kernel_dev); > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 7519ae003a082c..bd9878bdd4bfe9 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -2292,8 +2292,6 @@ extern struct vfsmount *kern_mount(struct file_system_type *); > extern void kern_unmount(struct vfsmount *mnt); > extern int may_umount_tree(struct vfsmount *); > extern int may_umount(struct vfsmount *); > -extern long do_mount(const char *, const char __user *, > - const char *, unsigned long, void *); > extern struct vfsmount *collect_mounts(const struct path *); > extern void drop_collected_mounts(struct vfsmount *); > extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
On Sun, Oct 11, 2020 at 07:17:49AM -0700, Guenter Roeck wrote: > Someone didn't bother test building this patch. > > arch/alpha/kernel/osf_sys.c: In function '__do_sys_osf_mount': > arch/alpha/kernel/osf_sys.c:437:14: error: 'path' redeclared as different kind of symbol Quite. Matter of fact, there's another problem (path_mount() that needs to be moved from fs/internal.h for that) and IMO this is simply not worth bothering with. I don't see any benefits in the last commit in there; the next-to-last one has some point, and it's not hard to fix, but since it clearly got no testing whatsoever... Christoph, if you want it back, resend it later, *after* having tested it. qemu-system-alpha works well enough to boot the last released debian/alpha. For now I'm dropping the last two commits from that branch.
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 5fd155b13503b5..8acd5101097576 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c @@ -434,6 +434,7 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path, struct osf_mount_args tmp; struct filename *devname; const char *fstype; + struct path path; int retval; if (copy_from_user(&tmp, args, sizeof(tmp))) @@ -467,7 +468,11 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path, if (IS_ERR(devname)) return PTR_ERR(devname); - retval = do_mount(devname.name, dirname, fstype, flags, NULL); + retval = user_path_at(AT_FDCWD, dirname, LOOKUP_FOLLOW, &path); + if (!retval) { + ret = path_mount(devname.name, &path, fstype, flags, NULL); + path_put(&path); + } putname(devname); return retval; } diff --git a/fs/namespace.c b/fs/namespace.c index 12b431b61462b9..2ff373ebeaf27f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3193,20 +3193,6 @@ int path_mount(const char *dev_name, struct path *path, data_page); } -long do_mount(const char *dev_name, const char __user *dir_name, - const char *type_page, unsigned long flags, void *data_page) -{ - struct path path; - int ret; - - ret = user_path_at(AT_FDCWD, dir_name, LOOKUP_FOLLOW, &path); - if (ret) - return ret; - ret = path_mount(dev_name, &path, type_page, flags, data_page); - path_put(&path); - return ret; -} - static struct ucounts *inc_mnt_namespaces(struct user_namespace *ns) { return inc_ucount(ns, current_euid(), UCOUNT_MNT_NAMESPACES); @@ -3390,10 +3376,11 @@ EXPORT_SYMBOL(mount_subtree); SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, char __user *, type, unsigned long, flags, void __user *, data) { - int ret; + struct path path; char *kernel_type; char *kernel_dev; void *options; + int ret; kernel_type = copy_mount_string(type); ret = PTR_ERR(kernel_type); @@ -3410,8 +3397,12 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, if (IS_ERR(options)) goto out_data; - ret = do_mount(kernel_dev, dir_name, kernel_type, flags, options); - + ret = user_path_at(AT_FDCWD, dir_name, LOOKUP_FOLLOW, &path); + if (ret) + goto out_options; + ret = path_mount(kernel_dev, &path, kernel_type, flags, options); + path_put(&path); +out_options: kfree(options); out_data: kfree(kernel_dev); diff --git a/include/linux/fs.h b/include/linux/fs.h index 7519ae003a082c..bd9878bdd4bfe9 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2292,8 +2292,6 @@ extern struct vfsmount *kern_mount(struct file_system_type *); extern void kern_unmount(struct vfsmount *mnt); extern int may_umount_tree(struct vfsmount *); extern int may_umount(struct vfsmount *); -extern long do_mount(const char *, const char __user *, - const char *, unsigned long, void *); extern struct vfsmount *collect_mounts(const struct path *); extern void drop_collected_mounts(struct vfsmount *); extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
There are only two callers left, one of which is is in the alpha-specific OSF/1 compat code. Just open code it in both. Signed-off-by: Christoph Hellwig <hch@lst.de> --- arch/alpha/kernel/osf_sys.c | 7 ++++++- fs/namespace.c | 25 ++++++++----------------- include/linux/fs.h | 2 -- 3 files changed, 14 insertions(+), 20 deletions(-)