aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/super.c22
-rw-r--r--include/linux/mount.h5
2 files changed, 20 insertions, 7 deletions
diff --git a/fs/super.c b/fs/super.c
index a66f66bb8049..848be4fc67a2 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -800,17 +800,13 @@ struct super_block *get_sb_single(struct file_system_type *fs_type,
800EXPORT_SYMBOL(get_sb_single); 800EXPORT_SYMBOL(get_sb_single);
801 801
802struct vfsmount * 802struct vfsmount *
803do_kern_mount(const char *fstype, int flags, const char *name, void *data) 803vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
804{ 804{
805 struct file_system_type *type = get_fs_type(fstype);
806 struct super_block *sb = ERR_PTR(-ENOMEM); 805 struct super_block *sb = ERR_PTR(-ENOMEM);
807 struct vfsmount *mnt; 806 struct vfsmount *mnt;
808 int error; 807 int error;
809 char *secdata = NULL; 808 char *secdata = NULL;
810 809
811 if (!type)
812 return ERR_PTR(-ENODEV);
813
814 mnt = alloc_vfsmnt(name); 810 mnt = alloc_vfsmnt(name);
815 if (!mnt) 811 if (!mnt)
816 goto out; 812 goto out;
@@ -841,7 +837,6 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
841 mnt->mnt_parent = mnt; 837 mnt->mnt_parent = mnt;
842 up_write(&sb->s_umount); 838 up_write(&sb->s_umount);
843 free_secdata(secdata); 839 free_secdata(secdata);
844 put_filesystem(type);
845 return mnt; 840 return mnt;
846out_sb: 841out_sb:
847 up_write(&sb->s_umount); 842 up_write(&sb->s_umount);
@@ -852,10 +847,23 @@ out_free_secdata:
852out_mnt: 847out_mnt:
853 free_vfsmnt(mnt); 848 free_vfsmnt(mnt);
854out: 849out:
855 put_filesystem(type);
856 return (struct vfsmount *)sb; 850 return (struct vfsmount *)sb;
857} 851}
858 852
853EXPORT_SYMBOL_GPL(vfs_kern_mount);
854
855struct vfsmount *
856do_kern_mount(const char *fstype, int flags, const char *name, void *data)
857{
858 struct file_system_type *type = get_fs_type(fstype);
859 struct vfsmount *mnt;
860 if (!type)
861 return ERR_PTR(-ENODEV);
862 mnt = vfs_kern_mount(type, flags, name, data);
863 put_filesystem(type);
864 return mnt;
865}
866
859EXPORT_SYMBOL_GPL(do_kern_mount); 867EXPORT_SYMBOL_GPL(do_kern_mount);
860 868
861struct vfsmount *kern_mount(struct file_system_type *type) 869struct vfsmount *kern_mount(struct file_system_type *type)
diff --git a/include/linux/mount.h b/include/linux/mount.h
index b7472ae91fa4..aff68c3660f5 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -73,6 +73,11 @@ extern struct vfsmount *alloc_vfsmnt(const char *name);
73extern struct vfsmount *do_kern_mount(const char *fstype, int flags, 73extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
74 const char *name, void *data); 74 const char *name, void *data);
75 75
76struct file_system_type;
77extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
78 int flags, const char *name,
79 void *data);
80
76struct nameidata; 81struct nameidata;
77 82
78extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, 83extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,