aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-29 11:06:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-29 11:06:25 -0400
commit53113b06e48c6c38f7612c1f8043b8a0d2adf72b (patch)
treeb50f098b72b6389fde956d8272c08169ff2b53cc
parent37542b6a7e73e81f8c066a48e6911e476ee3b22f (diff)
parenta4cdbd8bfb87ceff455aae85727077889b75001b (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (29 commits) braino in internal.h convert simple cases of nfs-related ->get_sb() to ->mount() convert btrfs convert ceph convert gfs2 convert afs convert ecryptfs convert sysfs convert cgroup and cpuset switch get_sb_ns() users switch procfs to ->mount() setting ->proc_mnt doesn't belong in proc_get_sb() convert cifs convert nilfs switch logfs to ->mount() logfs: fix a leak in get_sb logfs get_sb, part 3 logfs get_sb, part 2 logfs get_sb massage, part 1 convert v9fs ...
-rw-r--r--arch/ia64/kernel/perfmon.c9
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c10
-rw-r--r--arch/s390/hypfs/inode.c8
-rw-r--r--drivers/base/devtmpfs.c18
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c14
-rw-r--r--drivers/infiniband/hw/qib/qib_fs.c14
-rw-r--r--drivers/isdn/capi/capifs.c8
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c9
-rw-r--r--drivers/mtd/mtdchar.c10
-rw-r--r--drivers/mtd/mtdsuper.c54
-rw-r--r--drivers/oprofile/oprofilefs.c8
-rw-r--r--drivers/staging/autofs/init.c8
-rw-r--r--drivers/staging/pohmelfs/inode.c9
-rw-r--r--drivers/staging/smbfs/inode.c8
-rw-r--r--drivers/usb/core/inode.c8
-rw-r--r--drivers/usb/gadget/f_fs.c14
-rw-r--r--drivers/usb/gadget/inode.c10
-rw-r--r--drivers/xen/xenfs/super.c8
-rw-r--r--fs/9p/vfs_super.c22
-rw-r--r--fs/adfs/super.c9
-rw-r--r--fs/affs/super.c9
-rw-r--r--fs/afs/super.c19
-rw-r--r--fs/anon_inodes.c10
-rw-r--r--fs/autofs4/init.c8
-rw-r--r--fs/befs/linuxvfs.c11
-rw-r--r--fs/bfs/inode.c8
-rw-r--r--fs/binfmt_misc.c8
-rw-r--r--fs/block_dev.c8
-rw-r--r--fs/btrfs/super.c15
-rw-r--r--fs/ceph/super.c50
-rw-r--r--fs/cifs/cifsfs.c15
-rw-r--r--fs/coda/inode.c8
-rw-r--r--fs/configfs/mount.c8
-rw-r--r--fs/cramfs/inode.c9
-rw-r--r--fs/debugfs/inode.c8
-rw-r--r--fs/devpts/inode.c32
-rw-r--r--fs/ecryptfs/main.c12
-rw-r--r--fs/efs/super.c8
-rw-r--r--fs/exofs/super.c10
-rw-r--r--fs/ext2/super.c8
-rw-r--r--fs/ext3/super.c8
-rw-r--r--fs/ext4/super.c16
-rw-r--r--fs/fat/namei_msdos.c9
-rw-r--r--fs/fat/namei_vfat.c9
-rw-r--r--fs/freevxfs/vxfs_super.c9
-rw-r--r--fs/fuse/control.c10
-rw-r--r--fs/fuse/inode.c17
-rw-r--r--fs/gfs2/ops_fstype.c51
-rw-r--r--fs/hfs/super.c9
-rw-r--r--fs/hfsplus/super.c10
-rw-r--r--fs/hostfs/hostfs_kern.c8
-rw-r--r--fs/hpfs/super.c9
-rw-r--r--fs/hppfs/hppfs.c8
-rw-r--r--fs/hugetlbfs/inode.c8
-rw-r--r--fs/internal.h2
-rw-r--r--fs/isofs/inode.c9
-rw-r--r--fs/jffs2/super.c9
-rw-r--r--fs/jfs/super.c9
-rw-r--r--fs/libfs.c14
-rw-r--r--fs/logfs/dev_bdev.c15
-rw-r--r--fs/logfs/dev_mtd.c18
-rw-r--r--fs/logfs/logfs.h22
-rw-r--r--fs/logfs/super.c77
-rw-r--r--fs/minix/inode.c9
-rw-r--r--fs/namei.c2
-rw-r--r--fs/ncpfs/inode.c8
-rw-r--r--fs/nfs/super.c96
-rw-r--r--fs/nfs/unlink.c4
-rw-r--r--fs/nfsd/nfsctl.c8
-rw-r--r--fs/nilfs2/super.c16
-rw-r--r--fs/ntfs/super.c9
-rw-r--r--fs/ocfs2/dlmfs/dlmfs.c8
-rw-r--r--fs/ocfs2/super.c11
-rw-r--r--fs/omfs/inode.c9
-rw-r--r--fs/open.c6
-rw-r--r--fs/openpromfs/inode.c8
-rw-r--r--fs/pipe.c9
-rw-r--r--fs/proc/root.c16
-rw-r--r--fs/qnx4/inode.c9
-rw-r--r--fs/ramfs/inode.c17
-rw-r--r--fs/reiserfs/super.c9
-rw-r--r--fs/romfs/super.c17
-rw-r--r--fs/squashfs/super.c10
-rw-r--r--fs/super.c111
-rw-r--r--fs/sysfs/mount.c32
-rw-r--r--fs/sysv/super.c17
-rw-r--r--fs/ubifs/super.c13
-rw-r--r--fs/udf/super.c9
-rw-r--r--fs/ufs/super.c8
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c12
-rw-r--r--include/linux/fs.h21
-rw-r--r--include/linux/mtd/super.h5
-rw-r--r--include/linux/ramfs.h4
-rw-r--r--ipc/mqueue.c8
-rw-r--r--kernel/cgroup.c11
-rw-r--r--kernel/cpuset.c13
-rw-r--r--mm/shmem.c10
-rw-r--r--net/socket.c10
-rw-r--r--net/sunrpc/rpc_pipe.c18
-rw-r--r--security/inode.c8
-rw-r--r--security/selinux/selinuxfs.c9
-rw-r--r--security/smack/smackfs.c12
102 files changed, 731 insertions, 759 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 6b1852f7f972..39e534f5a3b0 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -618,16 +618,15 @@ pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
618} 618}
619 619
620 620
621static int 621static struct dentry *
622pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, 622pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
623 struct vfsmount *mnt)
624{ 623{
625 return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC, mnt); 624 return mount_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC);
626} 625}
627 626
628static struct file_system_type pfm_fs_type = { 627static struct file_system_type pfm_fs_type = {
629 .name = "pfmfs", 628 .name = "pfmfs",
630 .get_sb = pfmfs_get_sb, 629 .mount = pfmfs_mount,
631 .kill_sb = kill_anon_super, 630 .kill_sb = kill_anon_super,
632}; 631};
633 632
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 5dec408d6703..3532b92de983 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -798,17 +798,17 @@ spufs_fill_super(struct super_block *sb, void *data, int silent)
798 return spufs_create_root(sb, data); 798 return spufs_create_root(sb, data);
799} 799}
800 800
801static int 801static struct dentry *
802spufs_get_sb(struct file_system_type *fstype, int flags, 802spufs_mount(struct file_system_type *fstype, int flags,
803 const char *name, void *data, struct vfsmount *mnt) 803 const char *name, void *data)
804{ 804{
805 return get_sb_single(fstype, flags, data, spufs_fill_super, mnt); 805 return mount_single(fstype, flags, data, spufs_fill_super);
806} 806}
807 807
808static struct file_system_type spufs_type = { 808static struct file_system_type spufs_type = {
809 .owner = THIS_MODULE, 809 .owner = THIS_MODULE,
810 .name = "spufs", 810 .name = "spufs",
811 .get_sb = spufs_get_sb, 811 .mount = spufs_mount,
812 .kill_sb = kill_litter_super, 812 .kill_sb = kill_litter_super,
813}; 813};
814 814
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 74d98670be27..47cc446dab8f 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -316,10 +316,10 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
316 return 0; 316 return 0;
317} 317}
318 318
319static int hypfs_get_super(struct file_system_type *fst, int flags, 319static struct dentry *hypfs_mount(struct file_system_type *fst, int flags,
320 const char *devname, void *data, struct vfsmount *mnt) 320 const char *devname, void *data)
321{ 321{
322 return get_sb_single(fst, flags, data, hypfs_fill_super, mnt); 322 return mount_single(fst, flags, data, hypfs_fill_super);
323} 323}
324 324
325static void hypfs_kill_super(struct super_block *sb) 325static void hypfs_kill_super(struct super_block *sb)
@@ -455,7 +455,7 @@ static const struct file_operations hypfs_file_ops = {
455static struct file_system_type hypfs_type = { 455static struct file_system_type hypfs_type = {
456 .owner = THIS_MODULE, 456 .owner = THIS_MODULE,
457 .name = "s390_hypfs", 457 .name = "s390_hypfs",
458 .get_sb = hypfs_get_super, 458 .mount = hypfs_mount,
459 .kill_sb = hypfs_kill_super 459 .kill_sb = hypfs_kill_super
460}; 460};
461 461
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index af0600143d1c..82bbb5967aa9 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -29,33 +29,33 @@
29static struct vfsmount *dev_mnt; 29static struct vfsmount *dev_mnt;
30 30
31#if defined CONFIG_DEVTMPFS_MOUNT 31#if defined CONFIG_DEVTMPFS_MOUNT
32static int dev_mount = 1; 32static int mount_dev = 1;
33#else 33#else
34static int dev_mount; 34static int mount_dev;
35#endif 35#endif
36 36
37static DEFINE_MUTEX(dirlock); 37static DEFINE_MUTEX(dirlock);
38 38
39static int __init mount_param(char *str) 39static int __init mount_param(char *str)
40{ 40{
41 dev_mount = simple_strtoul(str, NULL, 0); 41 mount_dev = simple_strtoul(str, NULL, 0);
42 return 1; 42 return 1;
43} 43}
44__setup("devtmpfs.mount=", mount_param); 44__setup("devtmpfs.mount=", mount_param);
45 45
46static int dev_get_sb(struct file_system_type *fs_type, int flags, 46static struct dentry *dev_mount(struct file_system_type *fs_type, int flags,
47 const char *dev_name, void *data, struct vfsmount *mnt) 47 const char *dev_name, void *data)
48{ 48{
49#ifdef CONFIG_TMPFS 49#ifdef CONFIG_TMPFS
50 return get_sb_single(fs_type, flags, data, shmem_fill_super, mnt); 50 return mount_single(fs_type, flags, data, shmem_fill_super);
51#else 51#else
52 return get_sb_single(fs_type, flags, data, ramfs_fill_super, mnt); 52 return mount_single(fs_type, flags, data, ramfs_fill_super);
53#endif 53#endif
54} 54}
55 55
56static struct file_system_type dev_fs_type = { 56static struct file_system_type dev_fs_type = {
57 .name = "devtmpfs", 57 .name = "devtmpfs",
58 .get_sb = dev_get_sb, 58 .mount = dev_mount,
59 .kill_sb = kill_litter_super, 59 .kill_sb = kill_litter_super,
60}; 60};
61 61
@@ -351,7 +351,7 @@ int devtmpfs_mount(const char *mntdir)
351{ 351{
352 int err; 352 int err;
353 353
354 if (!dev_mount) 354 if (!mount_dev)
355 return 0; 355 return 0;
356 356
357 if (!dev_mnt) 357 if (!dev_mnt)
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 12d5bf76302c..8c8afc716b98 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -362,13 +362,13 @@ bail:
362 return ret; 362 return ret;
363} 363}
364 364
365static int ipathfs_get_sb(struct file_system_type *fs_type, int flags, 365static struct dentry *ipathfs_mount(struct file_system_type *fs_type,
366 const char *dev_name, void *data, struct vfsmount *mnt) 366 int flags, const char *dev_name, void *data)
367{ 367{
368 int ret = get_sb_single(fs_type, flags, data, 368 struct dentry *ret;
369 ipathfs_fill_super, mnt); 369 ret = mount_single(fs_type, flags, data, ipathfs_fill_super);
370 if (ret >= 0) 370 if (!IS_ERR(ret))
371 ipath_super = mnt->mnt_sb; 371 ipath_super = ret->d_sb;
372 return ret; 372 return ret;
373} 373}
374 374
@@ -411,7 +411,7 @@ bail:
411static struct file_system_type ipathfs_fs_type = { 411static struct file_system_type ipathfs_fs_type = {
412 .owner = THIS_MODULE, 412 .owner = THIS_MODULE,
413 .name = "ipathfs", 413 .name = "ipathfs",
414 .get_sb = ipathfs_get_sb, 414 .mount = ipathfs_mount,
415 .kill_sb = ipathfs_kill_super, 415 .kill_sb = ipathfs_kill_super,
416}; 416};
417 417
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index 7e433d75c775..f99bddc01716 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -555,13 +555,13 @@ bail:
555 return ret; 555 return ret;
556} 556}
557 557
558static int qibfs_get_sb(struct file_system_type *fs_type, int flags, 558static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags,
559 const char *dev_name, void *data, struct vfsmount *mnt) 559 const char *dev_name, void *data)
560{ 560{
561 int ret = get_sb_single(fs_type, flags, data, 561 struct dentry *ret;
562 qibfs_fill_super, mnt); 562 ret = mount_single(fs_type, flags, data, qibfs_fill_super);
563 if (ret >= 0) 563 if (!IS_ERR(ret))
564 qib_super = mnt->mnt_sb; 564 qib_super = ret->d_sb;
565 return ret; 565 return ret;
566} 566}
567 567
@@ -603,7 +603,7 @@ int qibfs_remove(struct qib_devdata *dd)
603static struct file_system_type qibfs_fs_type = { 603static struct file_system_type qibfs_fs_type = {
604 .owner = THIS_MODULE, 604 .owner = THIS_MODULE,
605 .name = "ipathfs", 605 .name = "ipathfs",
606 .get_sb = qibfs_get_sb, 606 .mount = qibfs_mount,
607 .kill_sb = qibfs_kill_super, 607 .kill_sb = qibfs_kill_super,
608}; 608};
609 609
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
index 2b83850997c3..b4faed7fe0d3 100644
--- a/drivers/isdn/capi/capifs.c
+++ b/drivers/isdn/capi/capifs.c
@@ -125,16 +125,16 @@ fail:
125 return -ENOMEM; 125 return -ENOMEM;
126} 126}
127 127
128static int capifs_get_sb(struct file_system_type *fs_type, 128static struct dentry *capifs_mount(struct file_system_type *fs_type,
129 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 129 int flags, const char *dev_name, void *data)
130{ 130{
131 return get_sb_single(fs_type, flags, data, capifs_fill_super, mnt); 131 return mount_single(fs_type, flags, data, capifs_fill_super);
132} 132}
133 133
134static struct file_system_type capifs_fs_type = { 134static struct file_system_type capifs_fs_type = {
135 .owner = THIS_MODULE, 135 .owner = THIS_MODULE,
136 .name = "capifs", 136 .name = "capifs",
137 .get_sb = capifs_get_sb, 137 .mount = capifs_mount,
138 .kill_sb = kill_anon_super, 138 .kill_sb = kill_anon_super,
139}; 139};
140 140
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 0a53500636c9..d2d5d23416dd 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -91,11 +91,10 @@ static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root);
91static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent); 91static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent);
92 92
93 93
94static int ibmasmfs_get_super(struct file_system_type *fst, 94static struct dentry *ibmasmfs_mount(struct file_system_type *fst,
95 int flags, const char *name, void *data, 95 int flags, const char *name, void *data)
96 struct vfsmount *mnt)
97{ 96{
98 return get_sb_single(fst, flags, data, ibmasmfs_fill_super, mnt); 97 return mount_single(fst, flags, data, ibmasmfs_fill_super);
99} 98}
100 99
101static const struct super_operations ibmasmfs_s_ops = { 100static const struct super_operations ibmasmfs_s_ops = {
@@ -108,7 +107,7 @@ static const struct file_operations *ibmasmfs_dir_ops = &simple_dir_operations;
108static struct file_system_type ibmasmfs_type = { 107static struct file_system_type ibmasmfs_type = {
109 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
110 .name = "ibmasmfs", 109 .name = "ibmasmfs",
111 .get_sb = ibmasmfs_get_super, 110 .mount = ibmasmfs_mount,
112 .kill_sb = kill_litter_super, 111 .kill_sb = kill_litter_super,
113}; 112};
114 113
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 5ef45487b65f..a34a0fe14884 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -1030,17 +1030,15 @@ static const struct file_operations mtd_fops = {
1030#endif 1030#endif
1031}; 1031};
1032 1032
1033static int mtd_inodefs_get_sb(struct file_system_type *fs_type, int flags, 1033static struct dentry *mtd_inodefs_mount(struct file_system_type *fs_type,
1034 const char *dev_name, void *data, 1034 int flags, const char *dev_name, void *data)
1035 struct vfsmount *mnt)
1036{ 1035{
1037 return get_sb_pseudo(fs_type, "mtd_inode:", NULL, MTD_INODE_FS_MAGIC, 1036 return mount_pseudo(fs_type, "mtd_inode:", NULL, MTD_INODE_FS_MAGIC);
1038 mnt);
1039} 1037}
1040 1038
1041static struct file_system_type mtd_inodefs_type = { 1039static struct file_system_type mtd_inodefs_type = {
1042 .name = "mtd_inodefs", 1040 .name = "mtd_inodefs",
1043 .get_sb = mtd_inodefs_get_sb, 1041 .mount = mtd_inodefs_mount,
1044 .kill_sb = kill_anon_super, 1042 .kill_sb = kill_anon_super,
1045}; 1043};
1046 1044
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index 38e2ab07e7a3..16b02a1fc100 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -54,11 +54,10 @@ static int get_sb_mtd_set(struct super_block *sb, void *_mtd)
54/* 54/*
55 * get a superblock on an MTD-backed filesystem 55 * get a superblock on an MTD-backed filesystem
56 */ 56 */
57static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags, 57static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags,
58 const char *dev_name, void *data, 58 const char *dev_name, void *data,
59 struct mtd_info *mtd, 59 struct mtd_info *mtd,
60 int (*fill_super)(struct super_block *, void *, int), 60 int (*fill_super)(struct super_block *, void *, int))
61 struct vfsmount *mnt)
62{ 61{
63 struct super_block *sb; 62 struct super_block *sb;
64 int ret; 63 int ret;
@@ -79,57 +78,49 @@ static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags,
79 ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); 78 ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
80 if (ret < 0) { 79 if (ret < 0) {
81 deactivate_locked_super(sb); 80 deactivate_locked_super(sb);
82 return ret; 81 return ERR_PTR(ret);
83 } 82 }
84 83
85 /* go */ 84 /* go */
86 sb->s_flags |= MS_ACTIVE; 85 sb->s_flags |= MS_ACTIVE;
87 simple_set_mnt(mnt, sb); 86 return dget(sb->s_root);
88
89 return 0;
90 87
91 /* new mountpoint for an already mounted superblock */ 88 /* new mountpoint for an already mounted superblock */
92already_mounted: 89already_mounted:
93 DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n", 90 DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n",
94 mtd->index, mtd->name); 91 mtd->index, mtd->name);
95 simple_set_mnt(mnt, sb); 92 put_mtd_device(mtd);
96 ret = 0; 93 return dget(sb->s_root);
97 goto out_put;
98 94
99out_error: 95out_error:
100 ret = PTR_ERR(sb);
101out_put:
102 put_mtd_device(mtd); 96 put_mtd_device(mtd);
103 return ret; 97 return ERR_CAST(sb);
104} 98}
105 99
106/* 100/*
107 * get a superblock on an MTD-backed filesystem by MTD device number 101 * get a superblock on an MTD-backed filesystem by MTD device number
108 */ 102 */
109static int get_sb_mtd_nr(struct file_system_type *fs_type, int flags, 103static struct dentry *mount_mtd_nr(struct file_system_type *fs_type, int flags,
110 const char *dev_name, void *data, int mtdnr, 104 const char *dev_name, void *data, int mtdnr,
111 int (*fill_super)(struct super_block *, void *, int), 105 int (*fill_super)(struct super_block *, void *, int))
112 struct vfsmount *mnt)
113{ 106{
114 struct mtd_info *mtd; 107 struct mtd_info *mtd;
115 108
116 mtd = get_mtd_device(NULL, mtdnr); 109 mtd = get_mtd_device(NULL, mtdnr);
117 if (IS_ERR(mtd)) { 110 if (IS_ERR(mtd)) {
118 DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr); 111 DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr);
119 return PTR_ERR(mtd); 112 return ERR_CAST(mtd);
120 } 113 }
121 114
122 return get_sb_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super, 115 return mount_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super);
123 mnt);
124} 116}
125 117
126/* 118/*
127 * set up an MTD-based superblock 119 * set up an MTD-based superblock
128 */ 120 */
129int get_sb_mtd(struct file_system_type *fs_type, int flags, 121struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,
130 const char *dev_name, void *data, 122 const char *dev_name, void *data,
131 int (*fill_super)(struct super_block *, void *, int), 123 int (*fill_super)(struct super_block *, void *, int))
132 struct vfsmount *mnt)
133{ 124{
134#ifdef CONFIG_BLOCK 125#ifdef CONFIG_BLOCK
135 struct block_device *bdev; 126 struct block_device *bdev;
@@ -138,7 +129,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
138 int mtdnr; 129 int mtdnr;
139 130
140 if (!dev_name) 131 if (!dev_name)
141 return -EINVAL; 132 return ERR_PTR(-EINVAL);
142 133
143 DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name); 134 DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name);
144 135
@@ -156,10 +147,10 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
156 147
157 mtd = get_mtd_device_nm(dev_name + 4); 148 mtd = get_mtd_device_nm(dev_name + 4);
158 if (!IS_ERR(mtd)) 149 if (!IS_ERR(mtd))
159 return get_sb_mtd_aux( 150 return mount_mtd_aux(
160 fs_type, flags, 151 fs_type, flags,
161 dev_name, data, mtd, 152 dev_name, data, mtd,
162 fill_super, mnt); 153 fill_super);
163 154
164 printk(KERN_NOTICE "MTD:" 155 printk(KERN_NOTICE "MTD:"
165 " MTD device with name \"%s\" not found.\n", 156 " MTD device with name \"%s\" not found.\n",
@@ -174,9 +165,9 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
174 /* It was a valid number */ 165 /* It was a valid number */
175 DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n", 166 DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n",
176 mtdnr); 167 mtdnr);
177 return get_sb_mtd_nr(fs_type, flags, 168 return mount_mtd_nr(fs_type, flags,
178 dev_name, data, 169 dev_name, data,
179 mtdnr, fill_super, mnt); 170 mtdnr, fill_super);
180 } 171 }
181 } 172 }
182 } 173 }
@@ -189,7 +180,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
189 if (IS_ERR(bdev)) { 180 if (IS_ERR(bdev)) {
190 ret = PTR_ERR(bdev); 181 ret = PTR_ERR(bdev);
191 DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret); 182 DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret);
192 return ret; 183 return ERR_PTR(ret);
193 } 184 }
194 DEBUG(1, "MTDSB: lookup_bdev() returned 0\n"); 185 DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");
195 186
@@ -202,8 +193,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
202 if (major != MTD_BLOCK_MAJOR) 193 if (major != MTD_BLOCK_MAJOR)
203 goto not_an_MTD_device; 194 goto not_an_MTD_device;
204 195
205 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, 196 return mount_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super);
206 mnt);
207 197
208not_an_MTD_device: 198not_an_MTD_device:
209#endif /* CONFIG_BLOCK */ 199#endif /* CONFIG_BLOCK */
@@ -212,10 +202,10 @@ not_an_MTD_device:
212 printk(KERN_NOTICE 202 printk(KERN_NOTICE
213 "MTD: Attempt to mount non-MTD device \"%s\"\n", 203 "MTD: Attempt to mount non-MTD device \"%s\"\n",
214 dev_name); 204 dev_name);
215 return -EINVAL; 205 return ERR_PTR(-EINVAL);
216} 206}
217 207
218EXPORT_SYMBOL_GPL(get_sb_mtd); 208EXPORT_SYMBOL_GPL(mount_mtd);
219 209
220/* 210/*
221 * destroy an MTD-based superblock 211 * destroy an MTD-based superblock
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 449de59bf35b..e9ff6f7770be 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -259,17 +259,17 @@ static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
259} 259}
260 260
261 261
262static int oprofilefs_get_sb(struct file_system_type *fs_type, 262static struct dentry *oprofilefs_mount(struct file_system_type *fs_type,
263 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 263 int flags, const char *dev_name, void *data)
264{ 264{
265 return get_sb_single(fs_type, flags, data, oprofilefs_fill_super, mnt); 265 return mount_single(fs_type, flags, data, oprofilefs_fill_super);
266} 266}
267 267
268 268
269static struct file_system_type oprofilefs_type = { 269static struct file_system_type oprofilefs_type = {
270 .owner = THIS_MODULE, 270 .owner = THIS_MODULE,
271 .name = "oprofilefs", 271 .name = "oprofilefs",
272 .get_sb = oprofilefs_get_sb, 272 .mount = oprofilefs_mount,
273 .kill_sb = kill_litter_super, 273 .kill_sb = kill_litter_super,
274}; 274};
275 275
diff --git a/drivers/staging/autofs/init.c b/drivers/staging/autofs/init.c
index 765c72f42976..5e4b372ea663 100644
--- a/drivers/staging/autofs/init.c
+++ b/drivers/staging/autofs/init.c
@@ -14,16 +14,16 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include "autofs_i.h" 15#include "autofs_i.h"
16 16
17static int autofs_get_sb(struct file_system_type *fs_type, 17static struct dentry *autofs_mount(struct file_system_type *fs_type,
18 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 18 int flags, const char *dev_name, void *data)
19{ 19{
20 return get_sb_nodev(fs_type, flags, data, autofs_fill_super, mnt); 20 return mount_nodev(fs_type, flags, data, autofs_fill_super);
21} 21}
22 22
23static struct file_system_type autofs_fs_type = { 23static struct file_system_type autofs_fs_type = {
24 .owner = THIS_MODULE, 24 .owner = THIS_MODULE,
25 .name = "autofs", 25 .name = "autofs",
26 .get_sb = autofs_get_sb, 26 .mount = autofs_mount,
27 .kill_sb = autofs_kill_sb, 27 .kill_sb = autofs_kill_sb,
28}; 28};
29 29
diff --git a/drivers/staging/pohmelfs/inode.c b/drivers/staging/pohmelfs/inode.c
index c62d30017c07..61685ccceda8 100644
--- a/drivers/staging/pohmelfs/inode.c
+++ b/drivers/staging/pohmelfs/inode.c
@@ -1937,11 +1937,10 @@ err_out_exit:
1937/* 1937/*
1938 * Some VFS magic here... 1938 * Some VFS magic here...
1939 */ 1939 */
1940static int pohmelfs_get_sb(struct file_system_type *fs_type, 1940static struct dentry *pohmelfs_mount(struct file_system_type *fs_type,
1941 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1941 int flags, const char *dev_name, void *data)
1942{ 1942{
1943 return get_sb_nodev(fs_type, flags, data, pohmelfs_fill_super, 1943 return mount_nodev(fs_type, flags, data, pohmelfs_fill_super);
1944 mnt);
1945} 1944}
1946 1945
1947/* 1946/*
@@ -1958,7 +1957,7 @@ static void pohmelfs_kill_super(struct super_block *sb)
1958static struct file_system_type pohmel_fs_type = { 1957static struct file_system_type pohmel_fs_type = {
1959 .owner = THIS_MODULE, 1958 .owner = THIS_MODULE,
1960 .name = "pohmel", 1959 .name = "pohmel",
1961 .get_sb = pohmelfs_get_sb, 1960 .mount = pohmelfs_mount,
1962 .kill_sb = pohmelfs_kill_super, 1961 .kill_sb = pohmelfs_kill_super,
1963}; 1962};
1964 1963
diff --git a/drivers/staging/smbfs/inode.c b/drivers/staging/smbfs/inode.c
index 552951aa7498..f9c493591ce7 100644
--- a/drivers/staging/smbfs/inode.c
+++ b/drivers/staging/smbfs/inode.c
@@ -793,16 +793,16 @@ out:
793 return error; 793 return error;
794} 794}
795 795
796static int smb_get_sb(struct file_system_type *fs_type, 796static struct dentry *smb_mount(struct file_system_type *fs_type,
797 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 797 int flags, const char *dev_name, void *data)
798{ 798{
799 return get_sb_nodev(fs_type, flags, data, smb_fill_super, mnt); 799 return mount_nodev(fs_type, flags, data, smb_fill_super);
800} 800}
801 801
802static struct file_system_type smb_fs_type = { 802static struct file_system_type smb_fs_type = {
803 .owner = THIS_MODULE, 803 .owner = THIS_MODULE,
804 .name = "smbfs", 804 .name = "smbfs",
805 .get_sb = smb_get_sb, 805 .mount = smb_mount,
806 .kill_sb = kill_anon_super, 806 .kill_sb = kill_anon_super,
807 .fs_flags = FS_BINARY_MOUNTDATA, 807 .fs_flags = FS_BINARY_MOUNTDATA,
808}; 808};
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index e2f63c0ea09d..9819a4cc3b26 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -574,16 +574,16 @@ static void fs_remove_file (struct dentry *dentry)
574 574
575/* --------------------------------------------------------------------- */ 575/* --------------------------------------------------------------------- */
576 576
577static int usb_get_sb(struct file_system_type *fs_type, 577static struct dentry *usb_mount(struct file_system_type *fs_type,
578 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 578 int flags, const char *dev_name, void *data)
579{ 579{
580 return get_sb_single(fs_type, flags, data, usbfs_fill_super, mnt); 580 return mount_single(fs_type, flags, data, usbfs_fill_super);
581} 581}
582 582
583static struct file_system_type usb_fs_type = { 583static struct file_system_type usb_fs_type = {
584 .owner = THIS_MODULE, 584 .owner = THIS_MODULE,
585 .name = "usbfs", 585 .name = "usbfs",
586 .get_sb = usb_get_sb, 586 .mount = usb_mount,
587 .kill_sb = kill_litter_super, 587 .kill_sb = kill_litter_super,
588}; 588};
589 589
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index f276e9594f00..4a830df4fc31 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1176,9 +1176,9 @@ invalid:
1176 1176
1177/* "mount -t functionfs dev_name /dev/function" ends up here */ 1177/* "mount -t functionfs dev_name /dev/function" ends up here */
1178 1178
1179static int 1179static struct dentry *
1180ffs_fs_get_sb(struct file_system_type *t, int flags, 1180ffs_fs_mount(struct file_system_type *t, int flags,
1181 const char *dev_name, void *opts, struct vfsmount *mnt) 1181 const char *dev_name, void *opts)
1182{ 1182{
1183 struct ffs_sb_fill_data data = { 1183 struct ffs_sb_fill_data data = {
1184 .perms = { 1184 .perms = {
@@ -1194,14 +1194,14 @@ ffs_fs_get_sb(struct file_system_type *t, int flags,
1194 1194
1195 ret = functionfs_check_dev_callback(dev_name); 1195 ret = functionfs_check_dev_callback(dev_name);
1196 if (unlikely(ret < 0)) 1196 if (unlikely(ret < 0))
1197 return ret; 1197 return ERR_PTR(ret);
1198 1198
1199 ret = ffs_fs_parse_opts(&data, opts); 1199 ret = ffs_fs_parse_opts(&data, opts);
1200 if (unlikely(ret < 0)) 1200 if (unlikely(ret < 0))
1201 return ret; 1201 return ERR_PTR(ret);
1202 1202
1203 data.dev_name = dev_name; 1203 data.dev_name = dev_name;
1204 return get_sb_single(t, flags, &data, ffs_sb_fill, mnt); 1204 return mount_single(t, flags, &data, ffs_sb_fill);
1205} 1205}
1206 1206
1207static void 1207static void
@@ -1220,7 +1220,7 @@ ffs_fs_kill_sb(struct super_block *sb)
1220static struct file_system_type ffs_fs_type = { 1220static struct file_system_type ffs_fs_type = {
1221 .owner = THIS_MODULE, 1221 .owner = THIS_MODULE,
1222 .name = "functionfs", 1222 .name = "functionfs",
1223 .get_sb = ffs_fs_get_sb, 1223 .mount = ffs_fs_mount,
1224 .kill_sb = ffs_fs_kill_sb, 1224 .kill_sb = ffs_fs_kill_sb,
1225}; 1225};
1226 1226
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index ba145e7fbe03..3ed73f49cf18 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -2097,11 +2097,11 @@ enomem0:
2097} 2097}
2098 2098
2099/* "mount -t gadgetfs path /dev/gadget" ends up here */ 2099/* "mount -t gadgetfs path /dev/gadget" ends up here */
2100static int 2100static struct dentry *
2101gadgetfs_get_sb (struct file_system_type *t, int flags, 2101gadgetfs_mount (struct file_system_type *t, int flags,
2102 const char *path, void *opts, struct vfsmount *mnt) 2102 const char *path, void *opts)
2103{ 2103{
2104 return get_sb_single (t, flags, opts, gadgetfs_fill_super, mnt); 2104 return mount_single (t, flags, opts, gadgetfs_fill_super);
2105} 2105}
2106 2106
2107static void 2107static void
@@ -2119,7 +2119,7 @@ gadgetfs_kill_sb (struct super_block *sb)
2119static struct file_system_type gadgetfs_type = { 2119static struct file_system_type gadgetfs_type = {
2120 .owner = THIS_MODULE, 2120 .owner = THIS_MODULE,
2121 .name = shortname, 2121 .name = shortname,
2122 .get_sb = gadgetfs_get_sb, 2122 .mount = gadgetfs_mount,
2123 .kill_sb = gadgetfs_kill_sb, 2123 .kill_sb = gadgetfs_kill_sb,
2124}; 2124};
2125 2125
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index d6662b789b6b..f6339d11d59c 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -121,17 +121,17 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
121 return rc; 121 return rc;
122} 122}
123 123
124static int xenfs_get_sb(struct file_system_type *fs_type, 124static int xenfs_mount(struct file_system_type *fs_type,
125 int flags, const char *dev_name, 125 int flags, const char *dev_name,
126 void *data, struct vfsmount *mnt) 126 void *data)
127{ 127{
128 return get_sb_single(fs_type, flags, data, xenfs_fill_super, mnt); 128 return mount_single(fs_type, flags, data, xenfs_fill_super);
129} 129}
130 130
131static struct file_system_type xenfs_type = { 131static struct file_system_type xenfs_type = {
132 .owner = THIS_MODULE, 132 .owner = THIS_MODULE,
133 .name = "xenfs", 133 .name = "xenfs",
134 .get_sb = xenfs_get_sb, 134 .mount = xenfs_mount,
135 .kill_sb = kill_litter_super, 135 .kill_sb = kill_litter_super,
136}; 136};
137 137
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 48d4215c60a8..c55c614500ad 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -68,7 +68,7 @@ static int v9fs_set_super(struct super_block *s, void *data)
68 * v9fs_fill_super - populate superblock with info 68 * v9fs_fill_super - populate superblock with info
69 * @sb: superblock 69 * @sb: superblock
70 * @v9ses: session information 70 * @v9ses: session information
71 * @flags: flags propagated from v9fs_get_sb() 71 * @flags: flags propagated from v9fs_mount()
72 * 72 *
73 */ 73 */
74 74
@@ -99,18 +99,16 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
99} 99}
100 100
101/** 101/**
102 * v9fs_get_sb - mount a superblock 102 * v9fs_mount - mount a superblock
103 * @fs_type: file system type 103 * @fs_type: file system type
104 * @flags: mount flags 104 * @flags: mount flags
105 * @dev_name: device name that was mounted 105 * @dev_name: device name that was mounted
106 * @data: mount options 106 * @data: mount options
107 * @mnt: mountpoint record to be instantiated
108 * 107 *
109 */ 108 */
110 109
111static int v9fs_get_sb(struct file_system_type *fs_type, int flags, 110static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
112 const char *dev_name, void *data, 111 const char *dev_name, void *data)
113 struct vfsmount *mnt)
114{ 112{
115 struct super_block *sb = NULL; 113 struct super_block *sb = NULL;
116 struct inode *inode = NULL; 114 struct inode *inode = NULL;
@@ -124,7 +122,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
124 122
125 v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); 123 v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
126 if (!v9ses) 124 if (!v9ses)
127 return -ENOMEM; 125 return ERR_PTR(-ENOMEM);
128 126
129 fid = v9fs_session_init(v9ses, dev_name, data); 127 fid = v9fs_session_init(v9ses, dev_name, data);
130 if (IS_ERR(fid)) { 128 if (IS_ERR(fid)) {
@@ -186,15 +184,15 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
186 v9fs_fid_add(root, fid); 184 v9fs_fid_add(root, fid);
187 185
188 P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); 186 P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
189 simple_set_mnt(mnt, sb); 187 return dget(sb->s_root);
190 return 0;
191 188
192clunk_fid: 189clunk_fid:
193 p9_client_clunk(fid); 190 p9_client_clunk(fid);
194close_session: 191close_session:
195 v9fs_session_close(v9ses); 192 v9fs_session_close(v9ses);
196 kfree(v9ses); 193 kfree(v9ses);
197 return retval; 194 return ERR_PTR(retval);
195
198release_sb: 196release_sb:
199 /* 197 /*
200 * we will do the session_close and root dentry release 198 * we will do the session_close and root dentry release
@@ -204,7 +202,7 @@ release_sb:
204 */ 202 */
205 p9_client_clunk(fid); 203 p9_client_clunk(fid);
206 deactivate_locked_super(sb); 204 deactivate_locked_super(sb);
207 return retval; 205 return ERR_PTR(retval);
208} 206}
209 207
210/** 208/**
@@ -300,7 +298,7 @@ static const struct super_operations v9fs_super_ops_dotl = {
300 298
301struct file_system_type v9fs_fs_type = { 299struct file_system_type v9fs_fs_type = {
302 .name = "9p", 300 .name = "9p",
303 .get_sb = v9fs_get_sb, 301 .mount = v9fs_mount,
304 .kill_sb = v9fs_kill_super, 302 .kill_sb = v9fs_kill_super,
305 .owner = THIS_MODULE, 303 .owner = THIS_MODULE,
306 .fs_flags = FS_RENAME_DOES_D_MOVE, 304 .fs_flags = FS_RENAME_DOES_D_MOVE,
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index d9803f73236f..959dbff2d42d 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -490,17 +490,16 @@ error:
490 return -EINVAL; 490 return -EINVAL;
491} 491}
492 492
493static int adfs_get_sb(struct file_system_type *fs_type, 493static struct dentry *adfs_mount(struct file_system_type *fs_type,
494 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 494 int flags, const char *dev_name, void *data)
495{ 495{
496 return get_sb_bdev(fs_type, flags, dev_name, data, adfs_fill_super, 496 return mount_bdev(fs_type, flags, dev_name, data, adfs_fill_super);
497 mnt);
498} 497}
499 498
500static struct file_system_type adfs_fs_type = { 499static struct file_system_type adfs_fs_type = {
501 .owner = THIS_MODULE, 500 .owner = THIS_MODULE,
502 .name = "adfs", 501 .name = "adfs",
503 .get_sb = adfs_get_sb, 502 .mount = adfs_mount,
504 .kill_sb = kill_block_super, 503 .kill_sb = kill_block_super,
505 .fs_flags = FS_REQUIRES_DEV, 504 .fs_flags = FS_REQUIRES_DEV,
506}; 505};
diff --git a/fs/affs/super.c b/fs/affs/super.c
index fa4fbe1e238a..0cf7f4384cbd 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -573,17 +573,16 @@ affs_statfs(struct dentry *dentry, struct kstatfs *buf)
573 return 0; 573 return 0;
574} 574}
575 575
576static int affs_get_sb(struct file_system_type *fs_type, 576static struct dentry *affs_mount(struct file_system_type *fs_type,
577 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 577 int flags, const char *dev_name, void *data)
578{ 578{
579 return get_sb_bdev(fs_type, flags, dev_name, data, affs_fill_super, 579 return mount_bdev(fs_type, flags, dev_name, data, affs_fill_super);
580 mnt);
581} 580}
582 581
583static struct file_system_type affs_fs_type = { 582static struct file_system_type affs_fs_type = {
584 .owner = THIS_MODULE, 583 .owner = THIS_MODULE,
585 .name = "affs", 584 .name = "affs",
586 .get_sb = affs_get_sb, 585 .mount = affs_mount,
587 .kill_sb = kill_block_super, 586 .kill_sb = kill_block_super,
588 .fs_flags = FS_REQUIRES_DEV, 587 .fs_flags = FS_REQUIRES_DEV,
589}; 588};
diff --git a/fs/afs/super.c b/fs/afs/super.c
index eacf76d98ae0..27201cffece4 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -29,9 +29,8 @@
29#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */ 29#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
30 30
31static void afs_i_init_once(void *foo); 31static void afs_i_init_once(void *foo);
32static int afs_get_sb(struct file_system_type *fs_type, 32static struct dentry *afs_mount(struct file_system_type *fs_type,
33 int flags, const char *dev_name, 33 int flags, const char *dev_name, void *data);
34 void *data, struct vfsmount *mnt);
35static struct inode *afs_alloc_inode(struct super_block *sb); 34static struct inode *afs_alloc_inode(struct super_block *sb);
36static void afs_put_super(struct super_block *sb); 35static void afs_put_super(struct super_block *sb);
37static void afs_destroy_inode(struct inode *inode); 36static void afs_destroy_inode(struct inode *inode);
@@ -40,7 +39,7 @@ static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);
40struct file_system_type afs_fs_type = { 39struct file_system_type afs_fs_type = {
41 .owner = THIS_MODULE, 40 .owner = THIS_MODULE,
42 .name = "afs", 41 .name = "afs",
43 .get_sb = afs_get_sb, 42 .mount = afs_mount,
44 .kill_sb = kill_anon_super, 43 .kill_sb = kill_anon_super,
45 .fs_flags = 0, 44 .fs_flags = 0,
46}; 45};
@@ -359,11 +358,8 @@ error:
359/* 358/*
360 * get an AFS superblock 359 * get an AFS superblock
361 */ 360 */
362static int afs_get_sb(struct file_system_type *fs_type, 361static struct dentry *afs_mount(struct file_system_type *fs_type,
363 int flags, 362 int flags, const char *dev_name, void *options)
364 const char *dev_name,
365 void *options,
366 struct vfsmount *mnt)
367{ 363{
368 struct afs_mount_params params; 364 struct afs_mount_params params;
369 struct super_block *sb; 365 struct super_block *sb;
@@ -427,12 +423,11 @@ static int afs_get_sb(struct file_system_type *fs_type,
427 ASSERTCMP(sb->s_flags, &, MS_ACTIVE); 423 ASSERTCMP(sb->s_flags, &, MS_ACTIVE);
428 } 424 }
429 425
430 simple_set_mnt(mnt, sb);
431 afs_put_volume(params.volume); 426 afs_put_volume(params.volume);
432 afs_put_cell(params.cell); 427 afs_put_cell(params.cell);
433 kfree(new_opts); 428 kfree(new_opts);
434 _leave(" = 0 [%p]", sb); 429 _leave(" = 0 [%p]", sb);
435 return 0; 430 return dget(sb->s_root);
436 431
437error: 432error:
438 afs_put_volume(params.volume); 433 afs_put_volume(params.volume);
@@ -440,7 +435,7 @@ error:
440 key_put(params.key); 435 key_put(params.key);
441 kfree(new_opts); 436 kfree(new_opts);
442 _leave(" = %d", ret); 437 _leave(" = %d", ret);
443 return ret; 438 return ERR_PTR(ret);
444} 439}
445 440
446/* 441/*
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 5365527ca43f..57ce55b2564c 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -26,12 +26,10 @@ static struct vfsmount *anon_inode_mnt __read_mostly;
26static struct inode *anon_inode_inode; 26static struct inode *anon_inode_inode;
27static const struct file_operations anon_inode_fops; 27static const struct file_operations anon_inode_fops;
28 28
29static int anon_inodefs_get_sb(struct file_system_type *fs_type, int flags, 29static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type,
30 const char *dev_name, void *data, 30 int flags, const char *dev_name, void *data)
31 struct vfsmount *mnt)
32{ 31{
33 return get_sb_pseudo(fs_type, "anon_inode:", NULL, ANON_INODE_FS_MAGIC, 32 return mount_pseudo(fs_type, "anon_inode:", NULL, ANON_INODE_FS_MAGIC);
34 mnt);
35} 33}
36 34
37/* 35/*
@@ -45,7 +43,7 @@ static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen)
45 43
46static struct file_system_type anon_inode_fs_type = { 44static struct file_system_type anon_inode_fs_type = {
47 .name = "anon_inodefs", 45 .name = "anon_inodefs",
48 .get_sb = anon_inodefs_get_sb, 46 .mount = anon_inodefs_mount,
49 .kill_sb = kill_anon_super, 47 .kill_sb = kill_anon_super,
50}; 48};
51static const struct dentry_operations anon_inodefs_dentry_operations = { 49static const struct dentry_operations anon_inodefs_dentry_operations = {
diff --git a/fs/autofs4/init.c b/fs/autofs4/init.c
index 9722e4bd8957..c038727b4050 100644
--- a/fs/autofs4/init.c
+++ b/fs/autofs4/init.c
@@ -14,16 +14,16 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include "autofs_i.h" 15#include "autofs_i.h"
16 16
17static int autofs_get_sb(struct file_system_type *fs_type, 17static struct dentry *autofs_mount(struct file_system_type *fs_type,
18 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 18 int flags, const char *dev_name, void *data)
19{ 19{
20 return get_sb_nodev(fs_type, flags, data, autofs4_fill_super, mnt); 20 return mount_nodev(fs_type, flags, data, autofs4_fill_super);
21} 21}
22 22
23static struct file_system_type autofs_fs_type = { 23static struct file_system_type autofs_fs_type = {
24 .owner = THIS_MODULE, 24 .owner = THIS_MODULE,
25 .name = "autofs", 25 .name = "autofs",
26 .get_sb = autofs_get_sb, 26 .mount = autofs_mount,
27 .kill_sb = autofs4_kill_sb, 27 .kill_sb = autofs4_kill_sb,
28}; 28};
29 29
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index dc39d2824885..aa4e7c7ae3c6 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -913,18 +913,17 @@ befs_statfs(struct dentry *dentry, struct kstatfs *buf)
913 return 0; 913 return 0;
914} 914}
915 915
916static int 916static struct dentry *
917befs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, 917befs_mount(struct file_system_type *fs_type, int flags, const char *dev_name,
918 void *data, struct vfsmount *mnt) 918 void *data)
919{ 919{
920 return get_sb_bdev(fs_type, flags, dev_name, data, befs_fill_super, 920 return mount_bdev(fs_type, flags, dev_name, data, befs_fill_super);
921 mnt);
922} 921}
923 922
924static struct file_system_type befs_fs_type = { 923static struct file_system_type befs_fs_type = {
925 .owner = THIS_MODULE, 924 .owner = THIS_MODULE,
926 .name = "befs", 925 .name = "befs",
927 .get_sb = befs_get_sb, 926 .mount = befs_mount,
928 .kill_sb = kill_block_super, 927 .kill_sb = kill_block_super,
929 .fs_flags = FS_REQUIRES_DEV, 928 .fs_flags = FS_REQUIRES_DEV,
930}; 929};
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 883e77acd5a8..76db6d7d49bb 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -450,16 +450,16 @@ out:
450 return ret; 450 return ret;
451} 451}
452 452
453static int bfs_get_sb(struct file_system_type *fs_type, 453static struct dentry *bfs_mount(struct file_system_type *fs_type,
454 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 454 int flags, const char *dev_name, void *data)
455{ 455{
456 return get_sb_bdev(fs_type, flags, dev_name, data, bfs_fill_super, mnt); 456 return mount_bdev(fs_type, flags, dev_name, data, bfs_fill_super);
457} 457}
458 458
459static struct file_system_type bfs_fs_type = { 459static struct file_system_type bfs_fs_type = {
460 .owner = THIS_MODULE, 460 .owner = THIS_MODULE,
461 .name = "bfs", 461 .name = "bfs",
462 .get_sb = bfs_get_sb, 462 .mount = bfs_mount,
463 .kill_sb = kill_block_super, 463 .kill_sb = kill_block_super,
464 .fs_flags = FS_REQUIRES_DEV, 464 .fs_flags = FS_REQUIRES_DEV,
465}; 465};
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 29990f0eee0c..1befe2ec8186 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -706,10 +706,10 @@ static int bm_fill_super(struct super_block * sb, void * data, int silent)
706 return err; 706 return err;
707} 707}
708 708
709static int bm_get_sb(struct file_system_type *fs_type, 709static struct dentry *bm_mount(struct file_system_type *fs_type,
710 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 710 int flags, const char *dev_name, void *data)
711{ 711{
712 return get_sb_single(fs_type, flags, data, bm_fill_super, mnt); 712 return mount_single(fs_type, flags, data, bm_fill_super);
713} 713}
714 714
715static struct linux_binfmt misc_format = { 715static struct linux_binfmt misc_format = {
@@ -720,7 +720,7 @@ static struct linux_binfmt misc_format = {
720static struct file_system_type bm_fs_type = { 720static struct file_system_type bm_fs_type = {
721 .owner = THIS_MODULE, 721 .owner = THIS_MODULE,
722 .name = "binfmt_misc", 722 .name = "binfmt_misc",
723 .get_sb = bm_get_sb, 723 .mount = bm_mount,
724 .kill_sb = kill_litter_super, 724 .kill_sb = kill_litter_super,
725}; 725};
726 726
diff --git a/fs/block_dev.c b/fs/block_dev.c
index dea3b628a6ce..06e8ff12b97c 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -464,15 +464,15 @@ static const struct super_operations bdev_sops = {
464 .evict_inode = bdev_evict_inode, 464 .evict_inode = bdev_evict_inode,
465}; 465};
466 466
467static int bd_get_sb(struct file_system_type *fs_type, 467static struct dentry *bd_mount(struct file_system_type *fs_type,
468 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 468 int flags, const char *dev_name, void *data)
469{ 469{
470 return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576, mnt); 470 return mount_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576);
471} 471}
472 472
473static struct file_system_type bd_type = { 473static struct file_system_type bd_type = {
474 .name = "bdev", 474 .name = "bdev",
475 .get_sb = bd_get_sb, 475 .mount = bd_mount,
476 .kill_sb = kill_anon_super, 476 .kill_sb = kill_anon_super,
477}; 477};
478 478
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 144f8a5730f5..ebe46c628748 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -560,8 +560,8 @@ static int btrfs_test_super(struct super_block *s, void *data)
560 * Note: This is based on get_sb_bdev from fs/super.c with a few additions 560 * Note: This is based on get_sb_bdev from fs/super.c with a few additions
561 * for multiple device setup. Make sure to keep it in sync. 561 * for multiple device setup. Make sure to keep it in sync.
562 */ 562 */
563static int btrfs_get_sb(struct file_system_type *fs_type, int flags, 563static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
564 const char *dev_name, void *data, struct vfsmount *mnt) 564 const char *dev_name, void *data)
565{ 565{
566 struct block_device *bdev = NULL; 566 struct block_device *bdev = NULL;
567 struct super_block *s; 567 struct super_block *s;
@@ -580,7 +580,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
580 &subvol_name, &subvol_objectid, 580 &subvol_name, &subvol_objectid,
581 &fs_devices); 581 &fs_devices);
582 if (error) 582 if (error)
583 return error; 583 return ERR_PTR(error);
584 584
585 error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices); 585 error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices);
586 if (error) 586 if (error)
@@ -656,11 +656,8 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
656 root = new_root; 656 root = new_root;
657 } 657 }
658 658
659 mnt->mnt_sb = s;
660 mnt->mnt_root = root;
661
662 kfree(subvol_name); 659 kfree(subvol_name);
663 return 0; 660 return root;
664 661
665error_s: 662error_s:
666 error = PTR_ERR(s); 663 error = PTR_ERR(s);
@@ -669,7 +666,7 @@ error_close_devices:
669error_free_subvol_name: 666error_free_subvol_name:
670 kfree(subvol_name); 667 kfree(subvol_name);
671error: 668error:
672 return error; 669 return ERR_PTR(error);
673} 670}
674 671
675static int btrfs_remount(struct super_block *sb, int *flags, char *data) 672static int btrfs_remount(struct super_block *sb, int *flags, char *data)
@@ -746,7 +743,7 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
746static struct file_system_type btrfs_fs_type = { 743static struct file_system_type btrfs_fs_type = {
747 .owner = THIS_MODULE, 744 .owner = THIS_MODULE,
748 .name = "btrfs", 745 .name = "btrfs",
749 .get_sb = btrfs_get_sb, 746 .mount = btrfs_mount,
750 .kill_sb = kill_anon_super, 747 .kill_sb = kill_anon_super,
751 .fs_flags = FS_REQUIRES_DEV, 748 .fs_flags = FS_REQUIRES_DEV,
752}; 749};
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index d6e0e0421891..08b460ae0539 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -635,7 +635,7 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
635/* 635/*
636 * mount: join the ceph cluster, and open root directory. 636 * mount: join the ceph cluster, and open root directory.
637 */ 637 */
638static int ceph_mount(struct ceph_fs_client *fsc, struct vfsmount *mnt, 638static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
639 const char *path) 639 const char *path)
640{ 640{
641 int err; 641 int err;
@@ -678,16 +678,14 @@ static int ceph_mount(struct ceph_fs_client *fsc, struct vfsmount *mnt,
678 } 678 }
679 } 679 }
680 680
681 mnt->mnt_root = root;
682 mnt->mnt_sb = fsc->sb;
683
684 fsc->mount_state = CEPH_MOUNT_MOUNTED; 681 fsc->mount_state = CEPH_MOUNT_MOUNTED;
685 dout("mount success\n"); 682 dout("mount success\n");
686 err = 0; 683 mutex_unlock(&fsc->client->mount_mutex);
684 return root;
687 685
688out: 686out:
689 mutex_unlock(&fsc->client->mount_mutex); 687 mutex_unlock(&fsc->client->mount_mutex);
690 return err; 688 return ERR_PTR(err);
691 689
692fail: 690fail:
693 if (first) { 691 if (first) {
@@ -777,41 +775,45 @@ static int ceph_register_bdi(struct super_block *sb,
777 return err; 775 return err;
778} 776}
779 777
780static int ceph_get_sb(struct file_system_type *fs_type, 778static struct dentry *ceph_mount(struct file_system_type *fs_type,
781 int flags, const char *dev_name, void *data, 779 int flags, const char *dev_name, void *data)
782 struct vfsmount *mnt)
783{ 780{
784 struct super_block *sb; 781 struct super_block *sb;
785 struct ceph_fs_client *fsc; 782 struct ceph_fs_client *fsc;
783 struct dentry *res;
786 int err; 784 int err;
787 int (*compare_super)(struct super_block *, void *) = ceph_compare_super; 785 int (*compare_super)(struct super_block *, void *) = ceph_compare_super;
788 const char *path = NULL; 786 const char *path = NULL;
789 struct ceph_mount_options *fsopt = NULL; 787 struct ceph_mount_options *fsopt = NULL;
790 struct ceph_options *opt = NULL; 788 struct ceph_options *opt = NULL;
791 789
792 dout("ceph_get_sb\n"); 790 dout("ceph_mount\n");
793 err = parse_mount_options(&fsopt, &opt, flags, data, dev_name, &path); 791 err = parse_mount_options(&fsopt, &opt, flags, data, dev_name, &path);
794 if (err < 0) 792 if (err < 0) {
793 res = ERR_PTR(err);
795 goto out_final; 794 goto out_final;
795 }
796 796
797 /* create client (which we may/may not use) */ 797 /* create client (which we may/may not use) */
798 fsc = create_fs_client(fsopt, opt); 798 fsc = create_fs_client(fsopt, opt);
799 if (IS_ERR(fsc)) { 799 if (IS_ERR(fsc)) {
800 err = PTR_ERR(fsc); 800 res = ERR_CAST(fsc);
801 kfree(fsopt); 801 kfree(fsopt);
802 kfree(opt); 802 kfree(opt);
803 goto out_final; 803 goto out_final;
804 } 804 }
805 805
806 err = ceph_mdsc_init(fsc); 806 err = ceph_mdsc_init(fsc);
807 if (err < 0) 807 if (err < 0) {
808 res = ERR_PTR(err);
808 goto out; 809 goto out;
810 }
809 811
810 if (ceph_test_opt(fsc->client, NOSHARE)) 812 if (ceph_test_opt(fsc->client, NOSHARE))
811 compare_super = NULL; 813 compare_super = NULL;
812 sb = sget(fs_type, compare_super, ceph_set_super, fsc); 814 sb = sget(fs_type, compare_super, ceph_set_super, fsc);
813 if (IS_ERR(sb)) { 815 if (IS_ERR(sb)) {
814 err = PTR_ERR(sb); 816 res = ERR_CAST(sb);
815 goto out; 817 goto out;
816 } 818 }
817 819
@@ -823,16 +825,18 @@ static int ceph_get_sb(struct file_system_type *fs_type,
823 } else { 825 } else {
824 dout("get_sb using new client %p\n", fsc); 826 dout("get_sb using new client %p\n", fsc);
825 err = ceph_register_bdi(sb, fsc); 827 err = ceph_register_bdi(sb, fsc);
826 if (err < 0) 828 if (err < 0) {
829 res = ERR_PTR(err);
827 goto out_splat; 830 goto out_splat;
831 }
828 } 832 }
829 833
830 err = ceph_mount(fsc, mnt, path); 834 res = ceph_real_mount(fsc, path);
831 if (err < 0) 835 if (IS_ERR(res))
832 goto out_splat; 836 goto out_splat;
833 dout("root %p inode %p ino %llx.%llx\n", mnt->mnt_root, 837 dout("root %p inode %p ino %llx.%llx\n", res,
834 mnt->mnt_root->d_inode, ceph_vinop(mnt->mnt_root->d_inode)); 838 res->d_inode, ceph_vinop(res->d_inode));
835 return 0; 839 return res;
836 840
837out_splat: 841out_splat:
838 ceph_mdsc_close_sessions(fsc->mdsc); 842 ceph_mdsc_close_sessions(fsc->mdsc);
@@ -843,8 +847,8 @@ out:
843 ceph_mdsc_destroy(fsc); 847 ceph_mdsc_destroy(fsc);
844 destroy_fs_client(fsc); 848 destroy_fs_client(fsc);
845out_final: 849out_final:
846 dout("ceph_get_sb fail %d\n", err); 850 dout("ceph_mount fail %ld\n", PTR_ERR(res));
847 return err; 851 return res;
848} 852}
849 853
850static void ceph_kill_sb(struct super_block *s) 854static void ceph_kill_sb(struct super_block *s)
@@ -860,7 +864,7 @@ static void ceph_kill_sb(struct super_block *s)
860static struct file_system_type ceph_fs_type = { 864static struct file_system_type ceph_fs_type = {
861 .owner = THIS_MODULE, 865 .owner = THIS_MODULE,
862 .name = "ceph", 866 .name = "ceph",
863 .get_sb = ceph_get_sb, 867 .mount = ceph_mount,
864 .kill_sb = ceph_kill_sb, 868 .kill_sb = ceph_kill_sb,
865 .fs_flags = FS_RENAME_DOES_D_MOVE, 869 .fs_flags = FS_RENAME_DOES_D_MOVE,
866}; 870};
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 34371637f210..8bd5c2c243a5 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -545,9 +545,9 @@ static const struct super_operations cifs_super_ops = {
545#endif 545#endif
546}; 546};
547 547
548static int 548static struct dentry *
549cifs_get_sb(struct file_system_type *fs_type, 549cifs_do_mount(struct file_system_type *fs_type,
550 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 550 int flags, const char *dev_name, void *data)
551{ 551{
552 int rc; 552 int rc;
553 struct super_block *sb; 553 struct super_block *sb;
@@ -557,18 +557,17 @@ cifs_get_sb(struct file_system_type *fs_type,
557 cFYI(1, "Devname: %s flags: %d ", dev_name, flags); 557 cFYI(1, "Devname: %s flags: %d ", dev_name, flags);
558 558
559 if (IS_ERR(sb)) 559 if (IS_ERR(sb))
560 return PTR_ERR(sb); 560 return ERR_CAST(sb);
561 561
562 sb->s_flags = flags; 562 sb->s_flags = flags;
563 563
564 rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0); 564 rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0);
565 if (rc) { 565 if (rc) {
566 deactivate_locked_super(sb); 566 deactivate_locked_super(sb);
567 return rc; 567 return ERR_PTR(rc);
568 } 568 }
569 sb->s_flags |= MS_ACTIVE; 569 sb->s_flags |= MS_ACTIVE;
570 simple_set_mnt(mnt, sb); 570 return dget(sb->s_root);
571 return 0;
572} 571}
573 572
574static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, 573static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
@@ -634,7 +633,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
634struct file_system_type cifs_fs_type = { 633struct file_system_type cifs_fs_type = {
635 .owner = THIS_MODULE, 634 .owner = THIS_MODULE,
636 .name = "cifs", 635 .name = "cifs",
637 .get_sb = cifs_get_sb, 636 .mount = cifs_do_mount,
638 .kill_sb = kill_anon_super, 637 .kill_sb = kill_anon_super,
639 /* .fs_flags */ 638 /* .fs_flags */
640}; 639};
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 7993b96ca348..5ea57c8c7f97 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -306,16 +306,16 @@ static int coda_statfs(struct dentry *dentry, struct kstatfs *buf)
306 306
307/* init_coda: used by filesystems.c to register coda */ 307/* init_coda: used by filesystems.c to register coda */
308 308
309static int coda_get_sb(struct file_system_type *fs_type, 309static struct dentry *coda_mount(struct file_system_type *fs_type,
310 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 310 int flags, const char *dev_name, void *data)
311{ 311{
312 return get_sb_nodev(fs_type, flags, data, coda_fill_super, mnt); 312 return mount_nodev(fs_type, flags, data, coda_fill_super);
313} 313}
314 314
315struct file_system_type coda_fs_type = { 315struct file_system_type coda_fs_type = {
316 .owner = THIS_MODULE, 316 .owner = THIS_MODULE,
317 .name = "coda", 317 .name = "coda",
318 .get_sb = coda_get_sb, 318 .mount = coda_mount,
319 .kill_sb = kill_anon_super, 319 .kill_sb = kill_anon_super,
320 .fs_flags = FS_BINARY_MOUNTDATA, 320 .fs_flags = FS_BINARY_MOUNTDATA,
321}; 321};
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 8c8d64230c2d..7d3607febe1c 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -104,16 +104,16 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
104 return 0; 104 return 0;
105} 105}
106 106
107static int configfs_get_sb(struct file_system_type *fs_type, 107static struct dentry *configfs_do_mount(struct file_system_type *fs_type,
108 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 108 int flags, const char *dev_name, void *data)
109{ 109{
110 return get_sb_single(fs_type, flags, data, configfs_fill_super, mnt); 110 return mount_single(fs_type, flags, data, configfs_fill_super);
111} 111}
112 112
113static struct file_system_type configfs_fs_type = { 113static struct file_system_type configfs_fs_type = {
114 .owner = THIS_MODULE, 114 .owner = THIS_MODULE,
115 .name = "configfs", 115 .name = "configfs",
116 .get_sb = configfs_get_sb, 116 .mount = configfs_do_mount,
117 .kill_sb = kill_litter_super, 117 .kill_sb = kill_litter_super,
118}; 118};
119 119
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 1e7a33028d33..32fd5fe9ca0e 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -533,17 +533,16 @@ static const struct super_operations cramfs_ops = {
533 .statfs = cramfs_statfs, 533 .statfs = cramfs_statfs,
534}; 534};
535 535
536static int cramfs_get_sb(struct file_system_type *fs_type, 536static struct dentry *cramfs_mount(struct file_system_type *fs_type,
537 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 537 int flags, const char *dev_name, void *data)
538{ 538{
539 return get_sb_bdev(fs_type, flags, dev_name, data, cramfs_fill_super, 539 return mount_bdev(fs_type, flags, dev_name, data, cramfs_fill_super);
540 mnt);
541} 540}
542 541
543static struct file_system_type cramfs_fs_type = { 542static struct file_system_type cramfs_fs_type = {
544 .owner = THIS_MODULE, 543 .owner = THIS_MODULE,
545 .name = "cramfs", 544 .name = "cramfs",
546 .get_sb = cramfs_get_sb, 545 .mount = cramfs_mount,
547 .kill_sb = kill_block_super, 546 .kill_sb = kill_block_super,
548 .fs_flags = FS_REQUIRES_DEV, 547 .fs_flags = FS_REQUIRES_DEV,
549}; 548};
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index a4ed8380e98a..37a8ca7c1222 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -135,17 +135,17 @@ static int debug_fill_super(struct super_block *sb, void *data, int silent)
135 return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); 135 return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files);
136} 136}
137 137
138static int debug_get_sb(struct file_system_type *fs_type, 138static struct dentry *debug_mount(struct file_system_type *fs_type,
139 int flags, const char *dev_name, 139 int flags, const char *dev_name,
140 void *data, struct vfsmount *mnt) 140 void *data)
141{ 141{
142 return get_sb_single(fs_type, flags, data, debug_fill_super, mnt); 142 return mount_single(fs_type, flags, data, debug_fill_super);
143} 143}
144 144
145static struct file_system_type debug_fs_type = { 145static struct file_system_type debug_fs_type = {
146 .owner = THIS_MODULE, 146 .owner = THIS_MODULE,
147 .name = "debugfs", 147 .name = "debugfs",
148 .get_sb = debug_get_sb, 148 .mount = debug_mount,
149 .kill_sb = kill_litter_super, 149 .kill_sb = kill_litter_super,
150}; 150};
151 151
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 8b3ffd5b5235..1bb547c9cad6 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -331,7 +331,7 @@ static int compare_init_pts_sb(struct super_block *s, void *p)
331} 331}
332 332
333/* 333/*
334 * devpts_get_sb() 334 * devpts_mount()
335 * 335 *
336 * If the '-o newinstance' mount option was specified, mount a new 336 * If the '-o newinstance' mount option was specified, mount a new
337 * (private) instance of devpts. PTYs created in this instance are 337 * (private) instance of devpts. PTYs created in this instance are
@@ -345,20 +345,20 @@ static int compare_init_pts_sb(struct super_block *s, void *p)
345 * semantics in devpts while preserving backward compatibility of the 345 * semantics in devpts while preserving backward compatibility of the
346 * current 'single-namespace' semantics. i.e all mounts of devpts 346 * current 'single-namespace' semantics. i.e all mounts of devpts
347 * without the 'newinstance' mount option should bind to the initial 347 * without the 'newinstance' mount option should bind to the initial
348 * kernel mount, like get_sb_single(). 348 * kernel mount, like mount_single().
349 * 349 *
350 * Mounts with 'newinstance' option create a new, private namespace. 350 * Mounts with 'newinstance' option create a new, private namespace.
351 * 351 *
352 * NOTE: 352 * NOTE:
353 * 353 *
354 * For single-mount semantics, devpts cannot use get_sb_single(), 354 * For single-mount semantics, devpts cannot use mount_single(),
355 * because get_sb_single()/sget() find and use the super-block from 355 * because mount_single()/sget() find and use the super-block from
356 * the most recent mount of devpts. But that recent mount may be a 356 * the most recent mount of devpts. But that recent mount may be a
357 * 'newinstance' mount and get_sb_single() would pick the newinstance 357 * 'newinstance' mount and mount_single() would pick the newinstance
358 * super-block instead of the initial super-block. 358 * super-block instead of the initial super-block.
359 */ 359 */
360static int devpts_get_sb(struct file_system_type *fs_type, 360static struct dentry *devpts_mount(struct file_system_type *fs_type,
361 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 361 int flags, const char *dev_name, void *data)
362{ 362{
363 int error; 363 int error;
364 struct pts_mount_opts opts; 364 struct pts_mount_opts opts;
@@ -366,7 +366,7 @@ static int devpts_get_sb(struct file_system_type *fs_type,
366 366
367 error = parse_mount_options(data, PARSE_MOUNT, &opts); 367 error = parse_mount_options(data, PARSE_MOUNT, &opts);
368 if (error) 368 if (error)
369 return error; 369 return ERR_PTR(error);
370 370
371 if (opts.newinstance) 371 if (opts.newinstance)
372 s = sget(fs_type, NULL, set_anon_super, NULL); 372 s = sget(fs_type, NULL, set_anon_super, NULL);
@@ -374,7 +374,7 @@ static int devpts_get_sb(struct file_system_type *fs_type,
374 s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL); 374 s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL);
375 375
376 if (IS_ERR(s)) 376 if (IS_ERR(s))
377 return PTR_ERR(s); 377 return ERR_CAST(s);
378 378
379 if (!s->s_root) { 379 if (!s->s_root) {
380 s->s_flags = flags; 380 s->s_flags = flags;
@@ -390,13 +390,11 @@ static int devpts_get_sb(struct file_system_type *fs_type,
390 if (error) 390 if (error)
391 goto out_undo_sget; 391 goto out_undo_sget;
392 392
393 simple_set_mnt(mnt, s); 393 return dget(s->s_root);
394
395 return 0;
396 394
397out_undo_sget: 395out_undo_sget:
398 deactivate_locked_super(s); 396 deactivate_locked_super(s);
399 return error; 397 return ERR_PTR(error);
400} 398}
401 399
402#else 400#else
@@ -404,10 +402,10 @@ out_undo_sget:
404 * This supports only the legacy single-instance semantics (no 402 * This supports only the legacy single-instance semantics (no
405 * multiple-instance semantics) 403 * multiple-instance semantics)
406 */ 404 */
407static int devpts_get_sb(struct file_system_type *fs_type, int flags, 405static struct dentry *devpts_mount(struct file_system_type *fs_type, int flags,
408 const char *dev_name, void *data, struct vfsmount *mnt) 406 const char *dev_name, void *data)
409{ 407{
410 return get_sb_single(fs_type, flags, data, devpts_fill_super, mnt); 408 return mount_single(fs_type, flags, data, devpts_fill_super);
411} 409}
412#endif 410#endif
413 411
@@ -421,7 +419,7 @@ static void devpts_kill_sb(struct super_block *sb)
421 419
422static struct file_system_type devpts_fs_type = { 420static struct file_system_type devpts_fs_type = {
423 .name = "devpts", 421 .name = "devpts",
424 .get_sb = devpts_get_sb, 422 .mount = devpts_mount,
425 .kill_sb = devpts_kill_sb, 423 .kill_sb = devpts_kill_sb,
426}; 424};
427 425
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index cbd4e18adb20..8585934712d4 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -540,9 +540,8 @@ out:
540 * ecryptfs_interpose to perform most of the linking 540 * ecryptfs_interpose to perform most of the linking
541 * ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c) 541 * ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c)
542 */ 542 */
543static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, 543static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags,
544 const char *dev_name, void *raw_data, 544 const char *dev_name, void *raw_data)
545 struct vfsmount *mnt)
546{ 545{
547 struct super_block *s; 546 struct super_block *s;
548 struct ecryptfs_sb_info *sbi; 547 struct ecryptfs_sb_info *sbi;
@@ -607,8 +606,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags,
607 err = "Reading sb failed"; 606 err = "Reading sb failed";
608 goto out; 607 goto out;
609 } 608 }
610 simple_set_mnt(mnt, s); 609 return dget(s->s_root);
611 return 0;
612 610
613out: 611out:
614 if (sbi) { 612 if (sbi) {
@@ -616,7 +614,7 @@ out:
616 kmem_cache_free(ecryptfs_sb_info_cache, sbi); 614 kmem_cache_free(ecryptfs_sb_info_cache, sbi);
617 } 615 }
618 printk(KERN_ERR "%s; rc = [%d]\n", err, rc); 616 printk(KERN_ERR "%s; rc = [%d]\n", err, rc);
619 return rc; 617 return ERR_PTR(rc);
620} 618}
621 619
622/** 620/**
@@ -639,7 +637,7 @@ static void ecryptfs_kill_block_super(struct super_block *sb)
639static struct file_system_type ecryptfs_fs_type = { 637static struct file_system_type ecryptfs_fs_type = {
640 .owner = THIS_MODULE, 638 .owner = THIS_MODULE,
641 .name = "ecryptfs", 639 .name = "ecryptfs",
642 .get_sb = ecryptfs_get_sb, 640 .mount = ecryptfs_mount,
643 .kill_sb = ecryptfs_kill_block_super, 641 .kill_sb = ecryptfs_kill_block_super,
644 .fs_flags = 0 642 .fs_flags = 0
645}; 643};
diff --git a/fs/efs/super.c b/fs/efs/super.c
index f04942810818..5073a07652cc 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -20,16 +20,16 @@
20static int efs_statfs(struct dentry *dentry, struct kstatfs *buf); 20static int efs_statfs(struct dentry *dentry, struct kstatfs *buf);
21static int efs_fill_super(struct super_block *s, void *d, int silent); 21static int efs_fill_super(struct super_block *s, void *d, int silent);
22 22
23static int efs_get_sb(struct file_system_type *fs_type, 23static struct dentry *efs_mount(struct file_system_type *fs_type,
24 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 24 int flags, const char *dev_name, void *data)
25{ 25{
26 return get_sb_bdev(fs_type, flags, dev_name, data, efs_fill_super, mnt); 26 return mount_bdev(fs_type, flags, dev_name, data, efs_fill_super);
27} 27}
28 28
29static struct file_system_type efs_fs_type = { 29static struct file_system_type efs_fs_type = {
30 .owner = THIS_MODULE, 30 .owner = THIS_MODULE,
31 .name = "efs", 31 .name = "efs",
32 .get_sb = efs_get_sb, 32 .mount = efs_mount,
33 .kill_sb = kill_block_super, 33 .kill_sb = kill_block_super,
34 .fs_flags = FS_REQUIRES_DEV, 34 .fs_flags = FS_REQUIRES_DEV,
35}; 35};
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 047e92fa3af8..79c3ae6e0456 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -659,19 +659,19 @@ free_bdi:
659/* 659/*
660 * Set up the superblock (calls exofs_fill_super eventually) 660 * Set up the superblock (calls exofs_fill_super eventually)
661 */ 661 */
662static int exofs_get_sb(struct file_system_type *type, 662static struct dentry *exofs_mount(struct file_system_type *type,
663 int flags, const char *dev_name, 663 int flags, const char *dev_name,
664 void *data, struct vfsmount *mnt) 664 void *data)
665{ 665{
666 struct exofs_mountopt opts; 666 struct exofs_mountopt opts;
667 int ret; 667 int ret;
668 668
669 ret = parse_options(data, &opts); 669 ret = parse_options(data, &opts);
670 if (ret) 670 if (ret)
671 return ret; 671 return ERR_PTR(ret);
672 672
673 opts.dev_name = dev_name; 673 opts.dev_name = dev_name;
674 return get_sb_nodev(type, flags, &opts, exofs_fill_super, mnt); 674 return mount_nodev(type, flags, &opts, exofs_fill_super);
675} 675}
676 676
677/* 677/*
@@ -809,7 +809,7 @@ static const struct export_operations exofs_export_ops = {
809static struct file_system_type exofs_type = { 809static struct file_system_type exofs_type = {
810 .owner = THIS_MODULE, 810 .owner = THIS_MODULE,
811 .name = "exofs", 811 .name = "exofs",
812 .get_sb = exofs_get_sb, 812 .mount = exofs_mount,
813 .kill_sb = generic_shutdown_super, 813 .kill_sb = generic_shutdown_super,
814}; 814};
815 815
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 0901320671da..d89e0b6a2d78 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1356,10 +1356,10 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
1356 return 0; 1356 return 0;
1357} 1357}
1358 1358
1359static int ext2_get_sb(struct file_system_type *fs_type, 1359static struct dentry *ext2_mount(struct file_system_type *fs_type,
1360 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1360 int flags, const char *dev_name, void *data)
1361{ 1361{
1362 return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super, mnt); 1362 return mount_bdev(fs_type, flags, dev_name, data, ext2_fill_super);
1363} 1363}
1364 1364
1365#ifdef CONFIG_QUOTA 1365#ifdef CONFIG_QUOTA
@@ -1473,7 +1473,7 @@ out:
1473static struct file_system_type ext2_fs_type = { 1473static struct file_system_type ext2_fs_type = {
1474 .owner = THIS_MODULE, 1474 .owner = THIS_MODULE,
1475 .name = "ext2", 1475 .name = "ext2",
1476 .get_sb = ext2_get_sb, 1476 .mount = ext2_mount,
1477 .kill_sb = kill_block_super, 1477 .kill_sb = kill_block_super,
1478 .fs_flags = FS_REQUIRES_DEV, 1478 .fs_flags = FS_REQUIRES_DEV,
1479}; 1479};
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index db87413d3479..2fedaf8b5012 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -3020,16 +3020,16 @@ out:
3020 3020
3021#endif 3021#endif
3022 3022
3023static int ext3_get_sb(struct file_system_type *fs_type, 3023static struct dentry *ext3_mount(struct file_system_type *fs_type,
3024 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 3024 int flags, const char *dev_name, void *data)
3025{ 3025{
3026 return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super, mnt); 3026 return mount_bdev(fs_type, flags, dev_name, data, ext3_fill_super);
3027} 3027}
3028 3028
3029static struct file_system_type ext3_fs_type = { 3029static struct file_system_type ext3_fs_type = {
3030 .owner = THIS_MODULE, 3030 .owner = THIS_MODULE,
3031 .name = "ext3", 3031 .name = "ext3",
3032 .get_sb = ext3_get_sb, 3032 .mount = ext3_mount,
3033 .kill_sb = kill_block_super, 3033 .kill_sb = kill_block_super,
3034 .fs_flags = FS_REQUIRES_DEV, 3034 .fs_flags = FS_REQUIRES_DEV,
3035}; 3035};
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0348ce066592..40131b777af6 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -73,8 +73,8 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf);
73static int ext4_unfreeze(struct super_block *sb); 73static int ext4_unfreeze(struct super_block *sb);
74static void ext4_write_super(struct super_block *sb); 74static void ext4_write_super(struct super_block *sb);
75static int ext4_freeze(struct super_block *sb); 75static int ext4_freeze(struct super_block *sb);
76static int ext4_get_sb(struct file_system_type *fs_type, int flags, 76static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags,
77 const char *dev_name, void *data, struct vfsmount *mnt); 77 const char *dev_name, void *data);
78static void ext4_destroy_lazyinit_thread(void); 78static void ext4_destroy_lazyinit_thread(void);
79static void ext4_unregister_li_request(struct super_block *sb); 79static void ext4_unregister_li_request(struct super_block *sb);
80 80
@@ -82,7 +82,7 @@ static void ext4_unregister_li_request(struct super_block *sb);
82static struct file_system_type ext3_fs_type = { 82static struct file_system_type ext3_fs_type = {
83 .owner = THIS_MODULE, 83 .owner = THIS_MODULE,
84 .name = "ext3", 84 .name = "ext3",
85 .get_sb = ext4_get_sb, 85 .mount = ext4_mount,
86 .kill_sb = kill_block_super, 86 .kill_sb = kill_block_super,
87 .fs_flags = FS_REQUIRES_DEV, 87 .fs_flags = FS_REQUIRES_DEV,
88}; 88};
@@ -4667,17 +4667,17 @@ out:
4667 4667
4668#endif 4668#endif
4669 4669
4670static int ext4_get_sb(struct file_system_type *fs_type, int flags, 4670static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags,
4671 const char *dev_name, void *data, struct vfsmount *mnt) 4671 const char *dev_name, void *data)
4672{ 4672{
4673 return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); 4673 return mount_bdev(fs_type, flags, dev_name, data, ext4_fill_super);
4674} 4674}
4675 4675
4676#if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) 4676#if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23)
4677static struct file_system_type ext2_fs_type = { 4677static struct file_system_type ext2_fs_type = {
4678 .owner = THIS_MODULE, 4678 .owner = THIS_MODULE,
4679 .name = "ext2", 4679 .name = "ext2",
4680 .get_sb = ext4_get_sb, 4680 .mount = ext4_mount,
4681 .kill_sb = kill_block_super, 4681 .kill_sb = kill_block_super,
4682 .fs_flags = FS_REQUIRES_DEV, 4682 .fs_flags = FS_REQUIRES_DEV,
4683}; 4683};
@@ -4722,7 +4722,7 @@ static inline void unregister_as_ext3(void) { }
4722static struct file_system_type ext4_fs_type = { 4722static struct file_system_type ext4_fs_type = {
4723 .owner = THIS_MODULE, 4723 .owner = THIS_MODULE,
4724 .name = "ext4", 4724 .name = "ext4",
4725 .get_sb = ext4_get_sb, 4725 .mount = ext4_mount,
4726 .kill_sb = kill_block_super, 4726 .kill_sb = kill_block_super,
4727 .fs_flags = FS_REQUIRES_DEV, 4727 .fs_flags = FS_REQUIRES_DEV,
4728}; 4728};
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index bbca5c186ae7..3345aabd1dd7 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -675,18 +675,17 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent)
675 return 0; 675 return 0;
676} 676}
677 677
678static int msdos_get_sb(struct file_system_type *fs_type, 678static struct dentry *msdos_mount(struct file_system_type *fs_type,
679 int flags, const char *dev_name, 679 int flags, const char *dev_name,
680 void *data, struct vfsmount *mnt) 680 void *data)
681{ 681{
682 return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super, 682 return mount_bdev(fs_type, flags, dev_name, data, msdos_fill_super);
683 mnt);
684} 683}
685 684
686static struct file_system_type msdos_fs_type = { 685static struct file_system_type msdos_fs_type = {
687 .owner = THIS_MODULE, 686 .owner = THIS_MODULE,
688 .name = "msdos", 687 .name = "msdos",
689 .get_sb = msdos_get_sb, 688 .mount = msdos_mount,
690 .kill_sb = kill_block_super, 689 .kill_sb = kill_block_super,
691 .fs_flags = FS_REQUIRES_DEV, 690 .fs_flags = FS_REQUIRES_DEV,
692}; 691};
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 6f0f6c9a0152..b936703b8924 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -1071,18 +1071,17 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent)
1071 return 0; 1071 return 0;
1072} 1072}
1073 1073
1074static int vfat_get_sb(struct file_system_type *fs_type, 1074static struct dentry *vfat_mount(struct file_system_type *fs_type,
1075 int flags, const char *dev_name, 1075 int flags, const char *dev_name,
1076 void *data, struct vfsmount *mnt) 1076 void *data)
1077{ 1077{
1078 return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super, 1078 return mount_bdev(fs_type, flags, dev_name, data, vfat_fill_super);
1079 mnt);
1080} 1079}
1081 1080
1082static struct file_system_type vfat_fs_type = { 1081static struct file_system_type vfat_fs_type = {
1083 .owner = THIS_MODULE, 1082 .owner = THIS_MODULE,
1084 .name = "vfat", 1083 .name = "vfat",
1085 .get_sb = vfat_get_sb, 1084 .mount = vfat_mount,
1086 .kill_sb = kill_block_super, 1085 .kill_sb = kill_block_super,
1087 .fs_flags = FS_REQUIRES_DEV, 1086 .fs_flags = FS_REQUIRES_DEV,
1088}; 1087};
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index 71b0148b8784..9d1c99558389 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -246,17 +246,16 @@ out:
246/* 246/*
247 * The usual module blurb. 247 * The usual module blurb.
248 */ 248 */
249static int vxfs_get_sb(struct file_system_type *fs_type, 249static struct dentry *vxfs_mount(struct file_system_type *fs_type,
250 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 250 int flags, const char *dev_name, void *data)
251{ 251{
252 return get_sb_bdev(fs_type, flags, dev_name, data, vxfs_fill_super, 252 return mount_bdev(fs_type, flags, dev_name, data, vxfs_fill_super);
253 mnt);
254} 253}
255 254
256static struct file_system_type vxfs_fs_type = { 255static struct file_system_type vxfs_fs_type = {
257 .owner = THIS_MODULE, 256 .owner = THIS_MODULE,
258 .name = "vxfs", 257 .name = "vxfs",
259 .get_sb = vxfs_get_sb, 258 .mount = vxfs_mount,
260 .kill_sb = kill_block_super, 259 .kill_sb = kill_block_super,
261 .fs_flags = FS_REQUIRES_DEV, 260 .fs_flags = FS_REQUIRES_DEV,
262}; 261};
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 4eba07661e5c..85542a7daf40 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -322,12 +322,10 @@ static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent)
322 return 0; 322 return 0;
323} 323}
324 324
325static int fuse_ctl_get_sb(struct file_system_type *fs_type, int flags, 325static struct dentry *fuse_ctl_mount(struct file_system_type *fs_type,
326 const char *dev_name, void *raw_data, 326 int flags, const char *dev_name, void *raw_data)
327 struct vfsmount *mnt)
328{ 327{
329 return get_sb_single(fs_type, flags, raw_data, 328 return mount_single(fs_type, flags, raw_data, fuse_ctl_fill_super);
330 fuse_ctl_fill_super, mnt);
331} 329}
332 330
333static void fuse_ctl_kill_sb(struct super_block *sb) 331static void fuse_ctl_kill_sb(struct super_block *sb)
@@ -346,7 +344,7 @@ static void fuse_ctl_kill_sb(struct super_block *sb)
346static struct file_system_type fuse_ctl_fs_type = { 344static struct file_system_type fuse_ctl_fs_type = {
347 .owner = THIS_MODULE, 345 .owner = THIS_MODULE,
348 .name = "fusectl", 346 .name = "fusectl",
349 .get_sb = fuse_ctl_get_sb, 347 .mount = fuse_ctl_mount,
350 .kill_sb = fuse_ctl_kill_sb, 348 .kill_sb = fuse_ctl_kill_sb,
351}; 349};
352 350
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index da9e6e11374c..cfce3ad86a92 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1041,11 +1041,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
1041 return err; 1041 return err;
1042} 1042}
1043 1043
1044static int fuse_get_sb(struct file_system_type *fs_type, 1044static struct dentry *fuse_mount(struct file_system_type *fs_type,
1045 int flags, const char *dev_name, 1045 int flags, const char *dev_name,
1046 void *raw_data, struct vfsmount *mnt) 1046 void *raw_data)
1047{ 1047{
1048 return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); 1048 return mount_nodev(fs_type, flags, raw_data, fuse_fill_super);
1049} 1049}
1050 1050
1051static void fuse_kill_sb_anon(struct super_block *sb) 1051static void fuse_kill_sb_anon(struct super_block *sb)
@@ -1065,17 +1065,16 @@ static struct file_system_type fuse_fs_type = {
1065 .owner = THIS_MODULE, 1065 .owner = THIS_MODULE,
1066 .name = "fuse", 1066 .name = "fuse",
1067 .fs_flags = FS_HAS_SUBTYPE, 1067 .fs_flags = FS_HAS_SUBTYPE,
1068 .get_sb = fuse_get_sb, 1068 .mount = fuse_mount,
1069 .kill_sb = fuse_kill_sb_anon, 1069 .kill_sb = fuse_kill_sb_anon,
1070}; 1070};
1071 1071
1072#ifdef CONFIG_BLOCK 1072#ifdef CONFIG_BLOCK
1073static int fuse_get_sb_blk(struct file_system_type *fs_type, 1073static struct dentry *fuse_mount_blk(struct file_system_type *fs_type,
1074 int flags, const char *dev_name, 1074 int flags, const char *dev_name,
1075 void *raw_data, struct vfsmount *mnt) 1075 void *raw_data)
1076{ 1076{
1077 return get_sb_bdev(fs_type, flags, dev_name, raw_data, fuse_fill_super, 1077 return mount_bdev(fs_type, flags, dev_name, raw_data, fuse_fill_super);
1078 mnt);
1079} 1078}
1080 1079
1081static void fuse_kill_sb_blk(struct super_block *sb) 1080static void fuse_kill_sb_blk(struct super_block *sb)
@@ -1094,7 +1093,7 @@ static void fuse_kill_sb_blk(struct super_block *sb)
1094static struct file_system_type fuseblk_fs_type = { 1093static struct file_system_type fuseblk_fs_type = {
1095 .owner = THIS_MODULE, 1094 .owner = THIS_MODULE,
1096 .name = "fuseblk", 1095 .name = "fuseblk",
1097 .get_sb = fuse_get_sb_blk, 1096 .mount = fuse_mount_blk,
1098 .kill_sb = fuse_kill_sb_blk, 1097 .kill_sb = fuse_kill_sb_blk,
1099 .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE, 1098 .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE,
1100}; 1099};
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index cade1acbcea9..3eb1393f7b81 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1250,12 +1250,11 @@ static int test_gfs2_super(struct super_block *s, void *ptr)
1250} 1250}
1251 1251
1252/** 1252/**
1253 * gfs2_get_sb - Get the GFS2 superblock 1253 * gfs2_mount - Get the GFS2 superblock
1254 * @fs_type: The GFS2 filesystem type 1254 * @fs_type: The GFS2 filesystem type
1255 * @flags: Mount flags 1255 * @flags: Mount flags
1256 * @dev_name: The name of the device 1256 * @dev_name: The name of the device
1257 * @data: The mount arguments 1257 * @data: The mount arguments
1258 * @mnt: The vfsmnt for this mount
1259 * 1258 *
1260 * Q. Why not use get_sb_bdev() ? 1259 * Q. Why not use get_sb_bdev() ?
1261 * A. We need to select one of two root directories to mount, independent 1260 * A. We need to select one of two root directories to mount, independent
@@ -1264,8 +1263,8 @@ static int test_gfs2_super(struct super_block *s, void *ptr)
1264 * Returns: 0 or -ve on error 1263 * Returns: 0 or -ve on error
1265 */ 1264 */
1266 1265
1267static int gfs2_get_sb(struct file_system_type *fs_type, int flags, 1266static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
1268 const char *dev_name, void *data, struct vfsmount *mnt) 1267 const char *dev_name, void *data)
1269{ 1268{
1270 struct block_device *bdev; 1269 struct block_device *bdev;
1271 struct super_block *s; 1270 struct super_block *s;
@@ -1279,7 +1278,7 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
1279 1278
1280 bdev = open_bdev_exclusive(dev_name, mode, fs_type); 1279 bdev = open_bdev_exclusive(dev_name, mode, fs_type);
1281 if (IS_ERR(bdev)) 1280 if (IS_ERR(bdev))
1282 return PTR_ERR(bdev); 1281 return ERR_CAST(bdev);
1283 1282
1284 /* 1283 /*
1285 * once the super is inserted into the list by sget, s_umount 1284 * once the super is inserted into the list by sget, s_umount
@@ -1298,6 +1297,9 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
1298 if (IS_ERR(s)) 1297 if (IS_ERR(s))
1299 goto error_bdev; 1298 goto error_bdev;
1300 1299
1300 if (s->s_root)
1301 close_bdev_exclusive(bdev, mode);
1302
1301 memset(&args, 0, sizeof(args)); 1303 memset(&args, 0, sizeof(args));
1302 args.ar_quota = GFS2_QUOTA_DEFAULT; 1304 args.ar_quota = GFS2_QUOTA_DEFAULT;
1303 args.ar_data = GFS2_DATA_DEFAULT; 1305 args.ar_data = GFS2_DATA_DEFAULT;
@@ -1309,17 +1311,13 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
1309 error = gfs2_mount_args(&args, data); 1311 error = gfs2_mount_args(&args, data);
1310 if (error) { 1312 if (error) {
1311 printk(KERN_WARNING "GFS2: can't parse mount arguments\n"); 1313 printk(KERN_WARNING "GFS2: can't parse mount arguments\n");
1312 if (s->s_root) 1314 goto error_super;
1313 goto error_super;
1314 deactivate_locked_super(s);
1315 return error;
1316 } 1315 }
1317 1316
1318 if (s->s_root) { 1317 if (s->s_root) {
1319 error = -EBUSY; 1318 error = -EBUSY;
1320 if ((flags ^ s->s_flags) & MS_RDONLY) 1319 if ((flags ^ s->s_flags) & MS_RDONLY)
1321 goto error_super; 1320 goto error_super;
1322 close_bdev_exclusive(bdev, mode);
1323 } else { 1321 } else {
1324 char b[BDEVNAME_SIZE]; 1322 char b[BDEVNAME_SIZE];
1325 1323
@@ -1328,27 +1326,24 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
1328 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); 1326 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
1329 sb_set_blocksize(s, block_size(bdev)); 1327 sb_set_blocksize(s, block_size(bdev));
1330 error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0); 1328 error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0);
1331 if (error) { 1329 if (error)
1332 deactivate_locked_super(s); 1330 goto error_super;
1333 return error;
1334 }
1335 s->s_flags |= MS_ACTIVE; 1331 s->s_flags |= MS_ACTIVE;
1336 bdev->bd_super = s; 1332 bdev->bd_super = s;
1337 } 1333 }
1338 1334
1339 sdp = s->s_fs_info; 1335 sdp = s->s_fs_info;
1340 mnt->mnt_sb = s;
1341 if (args.ar_meta) 1336 if (args.ar_meta)
1342 mnt->mnt_root = dget(sdp->sd_master_dir); 1337 return dget(sdp->sd_master_dir);
1343 else 1338 else
1344 mnt->mnt_root = dget(sdp->sd_root_dir); 1339 return dget(sdp->sd_root_dir);
1345 return 0;
1346 1340
1347error_super: 1341error_super:
1348 deactivate_locked_super(s); 1342 deactivate_locked_super(s);
1343 return ERR_PTR(error);
1349error_bdev: 1344error_bdev:
1350 close_bdev_exclusive(bdev, mode); 1345 close_bdev_exclusive(bdev, mode);
1351 return error; 1346 return ERR_PTR(error);
1352} 1347}
1353 1348
1354static int set_meta_super(struct super_block *s, void *ptr) 1349static int set_meta_super(struct super_block *s, void *ptr)
@@ -1356,8 +1351,8 @@ static int set_meta_super(struct super_block *s, void *ptr)
1356 return -EINVAL; 1351 return -EINVAL;
1357} 1352}
1358 1353
1359static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, 1354static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
1360 const char *dev_name, void *data, struct vfsmount *mnt) 1355 int flags, const char *dev_name, void *data)
1361{ 1356{
1362 struct super_block *s; 1357 struct super_block *s;
1363 struct gfs2_sbd *sdp; 1358 struct gfs2_sbd *sdp;
@@ -1368,23 +1363,21 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
1368 if (error) { 1363 if (error) {
1369 printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n", 1364 printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
1370 dev_name, error); 1365 dev_name, error);
1371 return error; 1366 return ERR_PTR(error);
1372 } 1367 }
1373 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, 1368 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super,
1374 path.dentry->d_inode->i_sb->s_bdev); 1369 path.dentry->d_inode->i_sb->s_bdev);
1375 path_put(&path); 1370 path_put(&path);
1376 if (IS_ERR(s)) { 1371 if (IS_ERR(s)) {
1377 printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n"); 1372 printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
1378 return PTR_ERR(s); 1373 return ERR_CAST(s);
1379 } 1374 }
1380 if ((flags ^ s->s_flags) & MS_RDONLY) { 1375 if ((flags ^ s->s_flags) & MS_RDONLY) {
1381 deactivate_locked_super(s); 1376 deactivate_locked_super(s);
1382 return -EBUSY; 1377 return ERR_PTR(-EBUSY);
1383 } 1378 }
1384 sdp = s->s_fs_info; 1379 sdp = s->s_fs_info;
1385 mnt->mnt_sb = s; 1380 return dget(sdp->sd_master_dir);
1386 mnt->mnt_root = dget(sdp->sd_master_dir);
1387 return 0;
1388} 1381}
1389 1382
1390static void gfs2_kill_sb(struct super_block *sb) 1383static void gfs2_kill_sb(struct super_block *sb)
@@ -1410,7 +1403,7 @@ static void gfs2_kill_sb(struct super_block *sb)
1410struct file_system_type gfs2_fs_type = { 1403struct file_system_type gfs2_fs_type = {
1411 .name = "gfs2", 1404 .name = "gfs2",
1412 .fs_flags = FS_REQUIRES_DEV, 1405 .fs_flags = FS_REQUIRES_DEV,
1413 .get_sb = gfs2_get_sb, 1406 .mount = gfs2_mount,
1414 .kill_sb = gfs2_kill_sb, 1407 .kill_sb = gfs2_kill_sb,
1415 .owner = THIS_MODULE, 1408 .owner = THIS_MODULE,
1416}; 1409};
@@ -1418,7 +1411,7 @@ struct file_system_type gfs2_fs_type = {
1418struct file_system_type gfs2meta_fs_type = { 1411struct file_system_type gfs2meta_fs_type = {
1419 .name = "gfs2meta", 1412 .name = "gfs2meta",
1420 .fs_flags = FS_REQUIRES_DEV, 1413 .fs_flags = FS_REQUIRES_DEV,
1421 .get_sb = gfs2_get_sb_meta, 1414 .mount = gfs2_mount_meta,
1422 .owner = THIS_MODULE, 1415 .owner = THIS_MODULE,
1423}; 1416};
1424 1417
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 6ee1586f2334..4824c27cebb8 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -441,17 +441,16 @@ bail:
441 return res; 441 return res;
442} 442}
443 443
444static int hfs_get_sb(struct file_system_type *fs_type, 444static struct dentry *hfs_mount(struct file_system_type *fs_type,
445 int flags, const char *dev_name, void *data, 445 int flags, const char *dev_name, void *data)
446 struct vfsmount *mnt)
447{ 446{
448 return get_sb_bdev(fs_type, flags, dev_name, data, hfs_fill_super, mnt); 447 return mount_bdev(fs_type, flags, dev_name, data, hfs_fill_super);
449} 448}
450 449
451static struct file_system_type hfs_fs_type = { 450static struct file_system_type hfs_fs_type = {
452 .owner = THIS_MODULE, 451 .owner = THIS_MODULE,
453 .name = "hfs", 452 .name = "hfs",
454 .get_sb = hfs_get_sb, 453 .mount = hfs_mount,
455 .kill_sb = kill_block_super, 454 .kill_sb = kill_block_super,
456 .fs_flags = FS_REQUIRES_DEV, 455 .fs_flags = FS_REQUIRES_DEV,
457}; 456};
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 9a88d7536103..52cc746d3ba3 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -495,18 +495,16 @@ static void hfsplus_destroy_inode(struct inode *inode)
495 495
496#define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info) 496#define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info)
497 497
498static int hfsplus_get_sb(struct file_system_type *fs_type, 498static struct dentry *hfsplus_mount(struct file_system_type *fs_type,
499 int flags, const char *dev_name, void *data, 499 int flags, const char *dev_name, void *data)
500 struct vfsmount *mnt)
501{ 500{
502 return get_sb_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super, 501 return mount_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super);
503 mnt);
504} 502}
505 503
506static struct file_system_type hfsplus_fs_type = { 504static struct file_system_type hfsplus_fs_type = {
507 .owner = THIS_MODULE, 505 .owner = THIS_MODULE,
508 .name = "hfsplus", 506 .name = "hfsplus",
509 .get_sb = hfsplus_get_sb, 507 .mount = hfsplus_mount,
510 .kill_sb = kill_block_super, 508 .kill_sb = kill_block_super,
511 .fs_flags = FS_REQUIRES_DEV, 509 .fs_flags = FS_REQUIRES_DEV,
512}; 510};
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index cd7c93917cc7..2c0f148a49e6 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -962,11 +962,11 @@ out:
962 return err; 962 return err;
963} 963}
964 964
965static int hostfs_read_sb(struct file_system_type *type, 965static struct dentry *hostfs_read_sb(struct file_system_type *type,
966 int flags, const char *dev_name, 966 int flags, const char *dev_name,
967 void *data, struct vfsmount *mnt) 967 void *data)
968{ 968{
969 return get_sb_nodev(type, flags, data, hostfs_fill_sb_common, mnt); 969 return mount_nodev(type, flags, data, hostfs_fill_sb_common);
970} 970}
971 971
972static void hostfs_kill_sb(struct super_block *s) 972static void hostfs_kill_sb(struct super_block *s)
@@ -978,7 +978,7 @@ static void hostfs_kill_sb(struct super_block *s)
978static struct file_system_type hostfs_type = { 978static struct file_system_type hostfs_type = {
979 .owner = THIS_MODULE, 979 .owner = THIS_MODULE,
980 .name = "hostfs", 980 .name = "hostfs",
981 .get_sb = hostfs_read_sb, 981 .mount = hostfs_read_sb,
982 .kill_sb = hostfs_kill_sb, 982 .kill_sb = hostfs_kill_sb,
983 .fs_flags = 0, 983 .fs_flags = 0,
984}; 984};
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index c969a1aa163a..bb69389972eb 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -686,17 +686,16 @@ bail0:
686 return -EINVAL; 686 return -EINVAL;
687} 687}
688 688
689static int hpfs_get_sb(struct file_system_type *fs_type, 689static struct dentry *hpfs_mount(struct file_system_type *fs_type,
690 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 690 int flags, const char *dev_name, void *data)
691{ 691{
692 return get_sb_bdev(fs_type, flags, dev_name, data, hpfs_fill_super, 692 return mount_bdev(fs_type, flags, dev_name, data, hpfs_fill_super);
693 mnt);
694} 693}
695 694
696static struct file_system_type hpfs_fs_type = { 695static struct file_system_type hpfs_fs_type = {
697 .owner = THIS_MODULE, 696 .owner = THIS_MODULE,
698 .name = "hpfs", 697 .name = "hpfs",
699 .get_sb = hpfs_get_sb, 698 .mount = hpfs_mount,
700 .kill_sb = kill_block_super, 699 .kill_sb = kill_block_super,
701 .fs_flags = FS_REQUIRES_DEV, 700 .fs_flags = FS_REQUIRES_DEV,
702}; 701};
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index 4e2a45ea6140..f702b5f713fc 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -748,17 +748,17 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
748 return(err); 748 return(err);
749} 749}
750 750
751static int hppfs_read_super(struct file_system_type *type, 751static struct dentry *hppfs_read_super(struct file_system_type *type,
752 int flags, const char *dev_name, 752 int flags, const char *dev_name,
753 void *data, struct vfsmount *mnt) 753 void *data)
754{ 754{
755 return get_sb_nodev(type, flags, data, hppfs_fill_super, mnt); 755 return mount_nodev(type, flags, data, hppfs_fill_super);
756} 756}
757 757
758static struct file_system_type hppfs_type = { 758static struct file_system_type hppfs_type = {
759 .owner = THIS_MODULE, 759 .owner = THIS_MODULE,
760 .name = "hppfs", 760 .name = "hppfs",
761 .get_sb = hppfs_read_super, 761 .mount = hppfs_read_super,
762 .kill_sb = kill_anon_super, 762 .kill_sb = kill_anon_super,
763 .fs_flags = 0, 763 .fs_flags = 0,
764}; 764};
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index b14be3f781c7..d6cfac1f0a40 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -896,15 +896,15 @@ void hugetlb_put_quota(struct address_space *mapping, long delta)
896 } 896 }
897} 897}
898 898
899static int hugetlbfs_get_sb(struct file_system_type *fs_type, 899static struct dentry *hugetlbfs_mount(struct file_system_type *fs_type,
900 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 900 int flags, const char *dev_name, void *data)
901{ 901{
902 return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super, mnt); 902 return mount_nodev(fs_type, flags, data, hugetlbfs_fill_super);
903} 903}
904 904
905static struct file_system_type hugetlbfs_fs_type = { 905static struct file_system_type hugetlbfs_fs_type = {
906 .name = "hugetlbfs", 906 .name = "hugetlbfs",
907 .get_sb = hugetlbfs_get_sb, 907 .mount = hugetlbfs_mount,
908 .kill_sb = kill_litter_super, 908 .kill_sb = kill_litter_super,
909}; 909};
910 910
diff --git a/fs/internal.h b/fs/internal.h
index ebad3b90752d..e43b9a4dbf4e 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -106,5 +106,5 @@ extern void release_open_intent(struct nameidata *);
106 * inode.c 106 * inode.c
107 */ 107 */
108extern int get_nr_dirty_inodes(void); 108extern int get_nr_dirty_inodes(void);
109extern int evict_inodes(struct super_block *); 109extern void evict_inodes(struct super_block *);
110extern int invalidate_inodes(struct super_block *); 110extern int invalidate_inodes(struct super_block *);
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 79cf7f616bbe..bfdeb82a53be 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1507,17 +1507,16 @@ struct inode *isofs_iget(struct super_block *sb,
1507 return inode; 1507 return inode;
1508} 1508}
1509 1509
1510static int isofs_get_sb(struct file_system_type *fs_type, 1510static struct dentry *isofs_mount(struct file_system_type *fs_type,
1511 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1511 int flags, const char *dev_name, void *data)
1512{ 1512{
1513 return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super, 1513 return mount_bdev(fs_type, flags, dev_name, data, isofs_fill_super);
1514 mnt);
1515} 1514}
1516 1515
1517static struct file_system_type iso9660_fs_type = { 1516static struct file_system_type iso9660_fs_type = {
1518 .owner = THIS_MODULE, 1517 .owner = THIS_MODULE,
1519 .name = "iso9660", 1518 .name = "iso9660",
1520 .get_sb = isofs_get_sb, 1519 .mount = isofs_mount,
1521 .kill_sb = kill_block_super, 1520 .kill_sb = kill_block_super,
1522 .fs_flags = FS_REQUIRES_DEV, 1521 .fs_flags = FS_REQUIRES_DEV,
1523}; 1522};
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index d1ae5dfc22b9..c86041b866a4 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -179,12 +179,11 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
179 return ret; 179 return ret;
180} 180}
181 181
182static int jffs2_get_sb(struct file_system_type *fs_type, 182static struct dentry *jffs2_mount(struct file_system_type *fs_type,
183 int flags, const char *dev_name, 183 int flags, const char *dev_name,
184 void *data, struct vfsmount *mnt) 184 void *data)
185{ 185{
186 return get_sb_mtd(fs_type, flags, dev_name, data, jffs2_fill_super, 186 return mount_mtd(fs_type, flags, dev_name, data, jffs2_fill_super);
187 mnt);
188} 187}
189 188
190static void jffs2_put_super (struct super_block *sb) 189static void jffs2_put_super (struct super_block *sb)
@@ -229,7 +228,7 @@ static void jffs2_kill_sb(struct super_block *sb)
229static struct file_system_type jffs2_fs_type = { 228static struct file_system_type jffs2_fs_type = {
230 .owner = THIS_MODULE, 229 .owner = THIS_MODULE,
231 .name = "jffs2", 230 .name = "jffs2",
232 .get_sb = jffs2_get_sb, 231 .mount = jffs2_mount,
233 .kill_sb = jffs2_kill_sb, 232 .kill_sb = jffs2_kill_sb,
234}; 233};
235 234
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 68eee2bf629e..0669fc1cc3bf 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -583,11 +583,10 @@ static int jfs_unfreeze(struct super_block *sb)
583 return 0; 583 return 0;
584} 584}
585 585
586static int jfs_get_sb(struct file_system_type *fs_type, 586static struct dentry *jfs_do_mount(struct file_system_type *fs_type,
587 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 587 int flags, const char *dev_name, void *data)
588{ 588{
589 return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super, 589 return mount_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
590 mnt);
591} 590}
592 591
593static int jfs_sync_fs(struct super_block *sb, int wait) 592static int jfs_sync_fs(struct super_block *sb, int wait)
@@ -770,7 +769,7 @@ static const struct export_operations jfs_export_operations = {
770static struct file_system_type jfs_fs_type = { 769static struct file_system_type jfs_fs_type = {
771 .owner = THIS_MODULE, 770 .owner = THIS_MODULE,
772 .name = "jfs", 771 .name = "jfs",
773 .get_sb = jfs_get_sb, 772 .mount = jfs_do_mount,
774 .kill_sb = kill_block_super, 773 .kill_sb = kill_block_super,
775 .fs_flags = FS_REQUIRES_DEV, 774 .fs_flags = FS_REQUIRES_DEV,
776}; 775};
diff --git a/fs/libfs.c b/fs/libfs.c
index 304a5132ca27..a3accdf528ad 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -201,9 +201,8 @@ static const struct super_operations simple_super_operations = {
201 * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that 201 * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that
202 * will never be mountable) 202 * will never be mountable)
203 */ 203 */
204int get_sb_pseudo(struct file_system_type *fs_type, char *name, 204struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name,
205 const struct super_operations *ops, unsigned long magic, 205 const struct super_operations *ops, unsigned long magic)
206 struct vfsmount *mnt)
207{ 206{
208 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); 207 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
209 struct dentry *dentry; 208 struct dentry *dentry;
@@ -211,7 +210,7 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
211 struct qstr d_name = {.name = name, .len = strlen(name)}; 210 struct qstr d_name = {.name = name, .len = strlen(name)};
212 211
213 if (IS_ERR(s)) 212 if (IS_ERR(s))
214 return PTR_ERR(s); 213 return ERR_CAST(s);
215 214
216 s->s_flags = MS_NOUSER; 215 s->s_flags = MS_NOUSER;
217 s->s_maxbytes = MAX_LFS_FILESIZE; 216 s->s_maxbytes = MAX_LFS_FILESIZE;
@@ -241,12 +240,11 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
241 d_instantiate(dentry, root); 240 d_instantiate(dentry, root);
242 s->s_root = dentry; 241 s->s_root = dentry;
243 s->s_flags |= MS_ACTIVE; 242 s->s_flags |= MS_ACTIVE;
244 simple_set_mnt(mnt, s); 243 return dget(s->s_root);
245 return 0;
246 244
247Enomem: 245Enomem:
248 deactivate_locked_super(s); 246 deactivate_locked_super(s);
249 return -ENOMEM; 247 return ERR_PTR(-ENOMEM);
250} 248}
251 249
252int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 250int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
@@ -951,7 +949,7 @@ EXPORT_SYMBOL(dcache_dir_lseek);
951EXPORT_SYMBOL(dcache_dir_open); 949EXPORT_SYMBOL(dcache_dir_open);
952EXPORT_SYMBOL(dcache_readdir); 950EXPORT_SYMBOL(dcache_readdir);
953EXPORT_SYMBOL(generic_read_dir); 951EXPORT_SYMBOL(generic_read_dir);
954EXPORT_SYMBOL(get_sb_pseudo); 952EXPORT_SYMBOL(mount_pseudo);
955EXPORT_SYMBOL(simple_write_begin); 953EXPORT_SYMBOL(simple_write_begin);
956EXPORT_SYMBOL(simple_write_end); 954EXPORT_SYMBOL(simple_write_end);
957EXPORT_SYMBOL(simple_dir_inode_operations); 955EXPORT_SYMBOL(simple_dir_inode_operations);
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index 9bd2ce2a3040..92ca6fbe09bd 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -298,9 +298,9 @@ static int bdev_write_sb(struct super_block *sb, struct page *page)
298 return sync_request(page, bdev, WRITE); 298 return sync_request(page, bdev, WRITE);
299} 299}
300 300
301static void bdev_put_device(struct super_block *sb) 301static void bdev_put_device(struct logfs_super *s)
302{ 302{
303 close_bdev_exclusive(logfs_super(sb)->s_bdev, FMODE_READ|FMODE_WRITE); 303 close_bdev_exclusive(s->s_bdev, FMODE_READ|FMODE_WRITE);
304} 304}
305 305
306static int bdev_can_write_buf(struct super_block *sb, u64 ofs) 306static int bdev_can_write_buf(struct super_block *sb, u64 ofs)
@@ -320,8 +320,8 @@ static const struct logfs_device_ops bd_devops = {
320 .put_device = bdev_put_device, 320 .put_device = bdev_put_device,
321}; 321};
322 322
323int logfs_get_sb_bdev(struct file_system_type *type, int flags, 323int logfs_get_sb_bdev(struct logfs_super *p, struct file_system_type *type,
324 const char *devname, struct vfsmount *mnt) 324 const char *devname)
325{ 325{
326 struct block_device *bdev; 326 struct block_device *bdev;
327 327
@@ -332,8 +332,11 @@ int logfs_get_sb_bdev(struct file_system_type *type, int flags,
332 if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) { 332 if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
333 int mtdnr = MINOR(bdev->bd_dev); 333 int mtdnr = MINOR(bdev->bd_dev);
334 close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE); 334 close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE);
335 return logfs_get_sb_mtd(type, flags, mtdnr, mnt); 335 return logfs_get_sb_mtd(p, mtdnr);
336 } 336 }
337 337
338 return logfs_get_sb_device(type, flags, NULL, bdev, &bd_devops, mnt); 338 p->s_bdev = bdev;
339 p->s_mtd = NULL;
340 p->s_devops = &bd_devops;
341 return 0;
339} 342}
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index a85d47d13e4b..7466e9dcc8c5 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -230,9 +230,9 @@ static void mtd_writeseg(struct super_block *sb, u64 ofs, size_t len)
230 __mtd_writeseg(sb, ofs, ofs >> PAGE_SHIFT, len >> PAGE_SHIFT); 230 __mtd_writeseg(sb, ofs, ofs >> PAGE_SHIFT, len >> PAGE_SHIFT);
231} 231}
232 232
233static void mtd_put_device(struct super_block *sb) 233static void mtd_put_device(struct logfs_super *s)
234{ 234{
235 put_mtd_device(logfs_super(sb)->s_mtd); 235 put_mtd_device(s->s_mtd);
236} 236}
237 237
238static int mtd_can_write_buf(struct super_block *sb, u64 ofs) 238static int mtd_can_write_buf(struct super_block *sb, u64 ofs)
@@ -265,14 +265,14 @@ static const struct logfs_device_ops mtd_devops = {
265 .put_device = mtd_put_device, 265 .put_device = mtd_put_device,
266}; 266};
267 267
268int logfs_get_sb_mtd(struct file_system_type *type, int flags, 268int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
269 int mtdnr, struct vfsmount *mnt)
270{ 269{
271 struct mtd_info *mtd; 270 struct mtd_info *mtd = get_mtd_device(NULL, mtdnr);
272 const struct logfs_device_ops *devops = &mtd_devops;
273
274 mtd = get_mtd_device(NULL, mtdnr);
275 if (IS_ERR(mtd)) 271 if (IS_ERR(mtd))
276 return PTR_ERR(mtd); 272 return PTR_ERR(mtd);
277 return logfs_get_sb_device(type, flags, mtd, NULL, devops, mnt); 273
274 s->s_bdev = NULL;
275 s->s_mtd = mtd;
276 s->s_devops = &mtd_devops;
277 return 0;
278} 278}
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h
index b8786264d243..cd51a36b37f0 100644
--- a/fs/logfs/logfs.h
+++ b/fs/logfs/logfs.h
@@ -136,6 +136,7 @@ struct logfs_area_ops {
136 int (*erase_segment)(struct logfs_area *area); 136 int (*erase_segment)(struct logfs_area *area);
137}; 137};
138 138
139struct logfs_super; /* forward */
139/** 140/**
140 * struct logfs_device_ops - device access operations 141 * struct logfs_device_ops - device access operations
141 * 142 *
@@ -156,7 +157,7 @@ struct logfs_device_ops {
156 int ensure_write); 157 int ensure_write);
157 int (*can_write_buf)(struct super_block *sb, u64 ofs); 158 int (*can_write_buf)(struct super_block *sb, u64 ofs);
158 void (*sync)(struct super_block *sb); 159 void (*sync)(struct super_block *sb);
159 void (*put_device)(struct super_block *sb); 160 void (*put_device)(struct logfs_super *s);
160}; 161};
161 162
162/** 163/**
@@ -471,11 +472,13 @@ void logfs_compr_exit(void);
471 472
472/* dev_bdev.c */ 473/* dev_bdev.c */
473#ifdef CONFIG_BLOCK 474#ifdef CONFIG_BLOCK
474int logfs_get_sb_bdev(struct file_system_type *type, int flags, 475int logfs_get_sb_bdev(struct logfs_super *s,
475 const char *devname, struct vfsmount *mnt); 476 struct file_system_type *type,
477 const char *devname);
476#else 478#else
477static inline int logfs_get_sb_bdev(struct file_system_type *type, int flags, 479static inline int logfs_get_sb_bdev(struct logfs_super *s,
478 const char *devname, struct vfsmount *mnt) 480 struct file_system_type *type,
481 const char *devname)
479{ 482{
480 return -ENODEV; 483 return -ENODEV;
481} 484}
@@ -483,11 +486,9 @@ static inline int logfs_get_sb_bdev(struct file_system_type *type, int flags,
483 486
484/* dev_mtd.c */ 487/* dev_mtd.c */
485#ifdef CONFIG_MTD 488#ifdef CONFIG_MTD
486int logfs_get_sb_mtd(struct file_system_type *type, int flags, 489int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
487 int mtdnr, struct vfsmount *mnt);
488#else 490#else
489static inline int logfs_get_sb_mtd(struct file_system_type *type, int flags, 491static inline int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
490 int mtdnr, struct vfsmount *mnt)
491{ 492{
492 return -ENODEV; 493 return -ENODEV;
493} 494}
@@ -619,9 +620,6 @@ void emergency_read_end(struct page *page);
619void logfs_crash_dump(struct super_block *sb); 620void logfs_crash_dump(struct super_block *sb);
620void *memchr_inv(const void *s, int c, size_t n); 621void *memchr_inv(const void *s, int c, size_t n);
621int logfs_statfs(struct dentry *dentry, struct kstatfs *stats); 622int logfs_statfs(struct dentry *dentry, struct kstatfs *stats);
622int logfs_get_sb_device(struct file_system_type *type, int flags,
623 struct mtd_info *mtd, struct block_device *bdev,
624 const struct logfs_device_ops *devops, struct vfsmount *mnt);
625int logfs_check_ds(struct logfs_disk_super *ds); 623int logfs_check_ds(struct logfs_disk_super *ds);
626int logfs_write_sb(struct super_block *sb); 624int logfs_write_sb(struct super_block *sb);
627 625
diff --git a/fs/logfs/super.c b/fs/logfs/super.c
index 5336155c5d81..33435e4b14d2 100644
--- a/fs/logfs/super.c
+++ b/fs/logfs/super.c
@@ -325,7 +325,7 @@ static int logfs_make_writeable(struct super_block *sb)
325 return 0; 325 return 0;
326} 326}
327 327
328static int logfs_get_sb_final(struct super_block *sb, struct vfsmount *mnt) 328static int logfs_get_sb_final(struct super_block *sb)
329{ 329{
330 struct logfs_super *super = logfs_super(sb); 330 struct logfs_super *super = logfs_super(sb);
331 struct inode *rootdir; 331 struct inode *rootdir;
@@ -356,7 +356,6 @@ static int logfs_get_sb_final(struct super_block *sb, struct vfsmount *mnt)
356 } 356 }
357 357
358 log_super("LogFS: Finished mounting\n"); 358 log_super("LogFS: Finished mounting\n");
359 simple_set_mnt(mnt, sb);
360 return 0; 359 return 0;
361 360
362fail: 361fail:
@@ -529,43 +528,37 @@ static void logfs_kill_sb(struct super_block *sb)
529 logfs_cleanup_rw(sb); 528 logfs_cleanup_rw(sb);
530 if (super->s_erase_page) 529 if (super->s_erase_page)
531 __free_page(super->s_erase_page); 530 __free_page(super->s_erase_page);
532 super->s_devops->put_device(sb); 531 super->s_devops->put_device(super);
533 logfs_mempool_destroy(super->s_btree_pool); 532 logfs_mempool_destroy(super->s_btree_pool);
534 logfs_mempool_destroy(super->s_alias_pool); 533 logfs_mempool_destroy(super->s_alias_pool);
535 kfree(super); 534 kfree(super);
536 log_super("LogFS: Finished unmounting\n"); 535 log_super("LogFS: Finished unmounting\n");
537} 536}
538 537
539int logfs_get_sb_device(struct file_system_type *type, int flags, 538static struct dentry *logfs_get_sb_device(struct logfs_super *super,
540 struct mtd_info *mtd, struct block_device *bdev, 539 struct file_system_type *type, int flags)
541 const struct logfs_device_ops *devops, struct vfsmount *mnt)
542{ 540{
543 struct logfs_super *super;
544 struct super_block *sb; 541 struct super_block *sb;
545 int err = -ENOMEM; 542 int err = -ENOMEM;
546 static int mount_count; 543 static int mount_count;
547 544
548 log_super("LogFS: Start mount %x\n", mount_count++); 545 log_super("LogFS: Start mount %x\n", mount_count++);
549 super = kzalloc(sizeof(*super), GFP_KERNEL);
550 if (!super)
551 goto err0;
552 546
553 super->s_mtd = mtd;
554 super->s_bdev = bdev;
555 err = -EINVAL; 547 err = -EINVAL;
556 sb = sget(type, logfs_sb_test, logfs_sb_set, super); 548 sb = sget(type, logfs_sb_test, logfs_sb_set, super);
557 if (IS_ERR(sb)) 549 if (IS_ERR(sb)) {
558 goto err0; 550 super->s_devops->put_device(super);
551 kfree(super);
552 return ERR_CAST(sb);
553 }
559 554
560 if (sb->s_root) { 555 if (sb->s_root) {
561 /* Device is already in use */ 556 /* Device is already in use */
562 err = 0; 557 super->s_devops->put_device(super);
563 simple_set_mnt(mnt, sb); 558 kfree(super);
564 goto err0; 559 return dget(sb->s_root);
565 } 560 }
566 561
567 super->s_devops = devops;
568
569 /* 562 /*
570 * sb->s_maxbytes is limited to 8TB. On 32bit systems, the page cache 563 * sb->s_maxbytes is limited to 8TB. On 32bit systems, the page cache
571 * only covers 16TB and the upper 8TB are used for indirect blocks. 564 * only covers 16TB and the upper 8TB are used for indirect blocks.
@@ -581,10 +574,12 @@ int logfs_get_sb_device(struct file_system_type *type, int flags,
581 goto err1; 574 goto err1;
582 575
583 sb->s_flags |= MS_ACTIVE; 576 sb->s_flags |= MS_ACTIVE;
584 err = logfs_get_sb_final(sb, mnt); 577 err = logfs_get_sb_final(sb);
585 if (err) 578 if (err) {
586 deactivate_locked_super(sb); 579 deactivate_locked_super(sb);
587 return err; 580 return ERR_PTR(err);
581 }
582 return dget(sb->s_root);
588 583
589err1: 584err1:
590 /* no ->s_root, no ->put_super() */ 585 /* no ->s_root, no ->put_super() */
@@ -592,37 +587,45 @@ err1:
592 iput(super->s_segfile_inode); 587 iput(super->s_segfile_inode);
593 iput(super->s_mapping_inode); 588 iput(super->s_mapping_inode);
594 deactivate_locked_super(sb); 589 deactivate_locked_super(sb);
595 return err; 590 return ERR_PTR(err);
596err0:
597 kfree(super);
598 //devops->put_device(sb);
599 return err;
600} 591}
601 592
602static int logfs_get_sb(struct file_system_type *type, int flags, 593static struct dentry *logfs_mount(struct file_system_type *type, int flags,
603 const char *devname, void *data, struct vfsmount *mnt) 594 const char *devname, void *data)
604{ 595{
605 ulong mtdnr; 596 ulong mtdnr;
597 struct logfs_super *super;
598 int err;
606 599
607 if (!devname) 600 super = kzalloc(sizeof(*super), GFP_KERNEL);
608 return logfs_get_sb_bdev(type, flags, devname, mnt); 601 if (!super)
609 if (strncmp(devname, "mtd", 3)) 602 return ERR_PTR(-ENOMEM);
610 return logfs_get_sb_bdev(type, flags, devname, mnt);
611 603
612 { 604 if (!devname)
605 err = logfs_get_sb_bdev(super, type, devname);
606 else if (strncmp(devname, "mtd", 3))
607 err = logfs_get_sb_bdev(super, type, devname);
608 else {
613 char *garbage; 609 char *garbage;
614 mtdnr = simple_strtoul(devname+3, &garbage, 0); 610 mtdnr = simple_strtoul(devname+3, &garbage, 0);
615 if (*garbage) 611 if (*garbage)
616 return -EINVAL; 612 err = -EINVAL;
613 else
614 err = logfs_get_sb_mtd(super, mtdnr);
615 }
616
617 if (err) {
618 kfree(super);
619 return ERR_PTR(err);
617 } 620 }
618 621
619 return logfs_get_sb_mtd(type, flags, mtdnr, mnt); 622 return logfs_get_sb_device(super, type, flags);
620} 623}
621 624
622static struct file_system_type logfs_fs_type = { 625static struct file_system_type logfs_fs_type = {
623 .owner = THIS_MODULE, 626 .owner = THIS_MODULE,
624 .name = "logfs", 627 .name = "logfs",
625 .get_sb = logfs_get_sb, 628 .mount = logfs_mount,
626 .kill_sb = logfs_kill_sb, 629 .kill_sb = logfs_kill_sb,
627 .fs_flags = FS_REQUIRES_DEV, 630 .fs_flags = FS_REQUIRES_DEV,
628 631
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index e39d6bf2e8fb..fb2020858a34 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -614,17 +614,16 @@ void minix_truncate(struct inode * inode)
614 V2_minix_truncate(inode); 614 V2_minix_truncate(inode);
615} 615}
616 616
617static int minix_get_sb(struct file_system_type *fs_type, 617static struct dentry *minix_mount(struct file_system_type *fs_type,
618 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 618 int flags, const char *dev_name, void *data)
619{ 619{
620 return get_sb_bdev(fs_type, flags, dev_name, data, minix_fill_super, 620 return mount_bdev(fs_type, flags, dev_name, data, minix_fill_super);
621 mnt);
622} 621}
623 622
624static struct file_system_type minix_fs_type = { 623static struct file_system_type minix_fs_type = {
625 .owner = THIS_MODULE, 624 .owner = THIS_MODULE,
626 .name = "minix", 625 .name = "minix",
627 .get_sb = minix_get_sb, 626 .mount = minix_mount,
628 .kill_sb = kill_block_super, 627 .kill_sb = kill_block_super,
629 .fs_flags = FS_REQUIRES_DEV, 628 .fs_flags = FS_REQUIRES_DEV,
630}; 629};
diff --git a/fs/namei.c b/fs/namei.c
index f7dbc06857ab..5362af9b7372 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1574,6 +1574,7 @@ static struct file *finish_open(struct nameidata *nd,
1574 */ 1574 */
1575 if (will_truncate) 1575 if (will_truncate)
1576 mnt_drop_write(nd->path.mnt); 1576 mnt_drop_write(nd->path.mnt);
1577 path_put(&nd->path);
1577 return filp; 1578 return filp;
1578 1579
1579exit: 1580exit:
@@ -1675,6 +1676,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
1675 } 1676 }
1676 filp = nameidata_to_filp(nd); 1677 filp = nameidata_to_filp(nd);
1677 mnt_drop_write(nd->path.mnt); 1678 mnt_drop_write(nd->path.mnt);
1679 path_put(&nd->path);
1678 if (!IS_ERR(filp)) { 1680 if (!IS_ERR(filp)) {
1679 error = ima_file_check(filp, acc_mode); 1681 error = ima_file_check(filp, acc_mode);
1680 if (error) { 1682 if (error) {
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 985fabb26aca..d290545aa0c4 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -1020,16 +1020,16 @@ out:
1020 return result; 1020 return result;
1021} 1021}
1022 1022
1023static int ncp_get_sb(struct file_system_type *fs_type, 1023static struct dentry *ncp_mount(struct file_system_type *fs_type,
1024 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1024 int flags, const char *dev_name, void *data)
1025{ 1025{
1026 return get_sb_nodev(fs_type, flags, data, ncp_fill_super, mnt); 1026 return mount_nodev(fs_type, flags, data, ncp_fill_super);
1027} 1027}
1028 1028
1029static struct file_system_type ncp_fs_type = { 1029static struct file_system_type ncp_fs_type = {
1030 .owner = THIS_MODULE, 1030 .owner = THIS_MODULE,
1031 .name = "ncpfs", 1031 .name = "ncpfs",
1032 .get_sb = ncp_get_sb, 1032 .mount = ncp_mount,
1033 .kill_sb = kill_anon_super, 1033 .kill_sb = kill_anon_super,
1034 .fs_flags = FS_BINARY_MOUNTDATA, 1034 .fs_flags = FS_BINARY_MOUNTDATA,
1035}; 1035};
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 3600ec700d58..0a42e8f4adcb 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -260,8 +260,8 @@ static int nfs_statfs(struct dentry *, struct kstatfs *);
260static int nfs_show_options(struct seq_file *, struct vfsmount *); 260static int nfs_show_options(struct seq_file *, struct vfsmount *);
261static int nfs_show_stats(struct seq_file *, struct vfsmount *); 261static int nfs_show_stats(struct seq_file *, struct vfsmount *);
262static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); 262static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *);
263static int nfs_xdev_get_sb(struct file_system_type *fs_type, 263static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type,
264 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 264 int flags, const char *dev_name, void *raw_data);
265static void nfs_put_super(struct super_block *); 265static void nfs_put_super(struct super_block *);
266static void nfs_kill_super(struct super_block *); 266static void nfs_kill_super(struct super_block *);
267static int nfs_remount(struct super_block *sb, int *flags, char *raw_data); 267static int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
@@ -277,7 +277,7 @@ static struct file_system_type nfs_fs_type = {
277struct file_system_type nfs_xdev_fs_type = { 277struct file_system_type nfs_xdev_fs_type = {
278 .owner = THIS_MODULE, 278 .owner = THIS_MODULE,
279 .name = "nfs", 279 .name = "nfs",
280 .get_sb = nfs_xdev_get_sb, 280 .mount = nfs_xdev_mount,
281 .kill_sb = nfs_kill_super, 281 .kill_sb = nfs_kill_super,
282 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 282 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
283}; 283};
@@ -302,14 +302,14 @@ static int nfs4_try_mount(int flags, const char *dev_name,
302 struct nfs_parsed_mount_data *data, struct vfsmount *mnt); 302 struct nfs_parsed_mount_data *data, struct vfsmount *mnt);
303static int nfs4_get_sb(struct file_system_type *fs_type, 303static int nfs4_get_sb(struct file_system_type *fs_type,
304 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 304 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
305static int nfs4_remote_get_sb(struct file_system_type *fs_type, 305static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type,
306 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 306 int flags, const char *dev_name, void *raw_data);
307static int nfs4_xdev_get_sb(struct file_system_type *fs_type, 307static struct dentry *nfs4_xdev_mount(struct file_system_type *fs_type,
308 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 308 int flags, const char *dev_name, void *raw_data);
309static int nfs4_referral_get_sb(struct file_system_type *fs_type, 309static int nfs4_referral_get_sb(struct file_system_type *fs_type,
310 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 310 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
311static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, 311static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type,
312 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 312 int flags, const char *dev_name, void *raw_data);
313static void nfs4_kill_super(struct super_block *sb); 313static void nfs4_kill_super(struct super_block *sb);
314 314
315static struct file_system_type nfs4_fs_type = { 315static struct file_system_type nfs4_fs_type = {
@@ -323,7 +323,7 @@ static struct file_system_type nfs4_fs_type = {
323static struct file_system_type nfs4_remote_fs_type = { 323static struct file_system_type nfs4_remote_fs_type = {
324 .owner = THIS_MODULE, 324 .owner = THIS_MODULE,
325 .name = "nfs4", 325 .name = "nfs4",
326 .get_sb = nfs4_remote_get_sb, 326 .mount = nfs4_remote_mount,
327 .kill_sb = nfs4_kill_super, 327 .kill_sb = nfs4_kill_super,
328 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 328 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
329}; 329};
@@ -331,7 +331,7 @@ static struct file_system_type nfs4_remote_fs_type = {
331struct file_system_type nfs4_xdev_fs_type = { 331struct file_system_type nfs4_xdev_fs_type = {
332 .owner = THIS_MODULE, 332 .owner = THIS_MODULE,
333 .name = "nfs4", 333 .name = "nfs4",
334 .get_sb = nfs4_xdev_get_sb, 334 .mount = nfs4_xdev_mount,
335 .kill_sb = nfs4_kill_super, 335 .kill_sb = nfs4_kill_super,
336 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 336 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
337}; 337};
@@ -339,7 +339,7 @@ struct file_system_type nfs4_xdev_fs_type = {
339static struct file_system_type nfs4_remote_referral_fs_type = { 339static struct file_system_type nfs4_remote_referral_fs_type = {
340 .owner = THIS_MODULE, 340 .owner = THIS_MODULE,
341 .name = "nfs4", 341 .name = "nfs4",
342 .get_sb = nfs4_remote_referral_get_sb, 342 .mount = nfs4_remote_referral_mount,
343 .kill_sb = nfs4_kill_super, 343 .kill_sb = nfs4_kill_super,
344 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 344 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
345}; 345};
@@ -2397,9 +2397,9 @@ static void nfs_kill_super(struct super_block *s)
2397/* 2397/*
2398 * Clone an NFS2/3 server record on xdev traversal (FSID-change) 2398 * Clone an NFS2/3 server record on xdev traversal (FSID-change)
2399 */ 2399 */
2400static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, 2400static struct dentry *
2401 const char *dev_name, void *raw_data, 2401nfs_xdev_mount(struct file_system_type *fs_type, int flags,
2402 struct vfsmount *mnt) 2402 const char *dev_name, void *raw_data)
2403{ 2403{
2404 struct nfs_clone_mount *data = raw_data; 2404 struct nfs_clone_mount *data = raw_data;
2405 struct super_block *s; 2405 struct super_block *s;
@@ -2411,7 +2411,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
2411 }; 2411 };
2412 int error; 2412 int error;
2413 2413
2414 dprintk("--> nfs_xdev_get_sb()\n"); 2414 dprintk("--> nfs_xdev_mount()\n");
2415 2415
2416 /* create a new volume representation */ 2416 /* create a new volume representation */
2417 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); 2417 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr);
@@ -2458,28 +2458,26 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
2458 } 2458 }
2459 2459
2460 s->s_flags |= MS_ACTIVE; 2460 s->s_flags |= MS_ACTIVE;
2461 mnt->mnt_sb = s;
2462 mnt->mnt_root = mntroot;
2463 2461
2464 /* clone any lsm security options from the parent to the new sb */ 2462 /* clone any lsm security options from the parent to the new sb */
2465 security_sb_clone_mnt_opts(data->sb, s); 2463 security_sb_clone_mnt_opts(data->sb, s);
2466 2464
2467 dprintk("<-- nfs_xdev_get_sb() = 0\n"); 2465 dprintk("<-- nfs_xdev_mount() = 0\n");
2468 return 0; 2466 return mntroot;
2469 2467
2470out_err_nosb: 2468out_err_nosb:
2471 nfs_free_server(server); 2469 nfs_free_server(server);
2472out_err_noserver: 2470out_err_noserver:
2473 dprintk("<-- nfs_xdev_get_sb() = %d [error]\n", error); 2471 dprintk("<-- nfs_xdev_mount() = %d [error]\n", error);
2474 return error; 2472 return ERR_PTR(error);
2475 2473
2476error_splat_super: 2474error_splat_super:
2477 if (server && !s->s_root) 2475 if (server && !s->s_root)
2478 bdi_unregister(&server->backing_dev_info); 2476 bdi_unregister(&server->backing_dev_info);
2479error_splat_bdi: 2477error_splat_bdi:
2480 deactivate_locked_super(s); 2478 deactivate_locked_super(s);
2481 dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); 2479 dprintk("<-- nfs_xdev_mount() = %d [splat]\n", error);
2482 return error; 2480 return ERR_PTR(error);
2483} 2481}
2484 2482
2485#ifdef CONFIG_NFS_V4 2483#ifdef CONFIG_NFS_V4
@@ -2649,8 +2647,9 @@ out_no_address:
2649/* 2647/*
2650 * Get the superblock for the NFS4 root partition 2648 * Get the superblock for the NFS4 root partition
2651 */ 2649 */
2652static int nfs4_remote_get_sb(struct file_system_type *fs_type, 2650static struct dentry *
2653 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) 2651nfs4_remote_mount(struct file_system_type *fs_type, int flags,
2652 const char *dev_name, void *raw_data)
2654{ 2653{
2655 struct nfs_parsed_mount_data *data = raw_data; 2654 struct nfs_parsed_mount_data *data = raw_data;
2656 struct super_block *s; 2655 struct super_block *s;
@@ -2714,15 +2713,16 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
2714 goto error_splat_root; 2713 goto error_splat_root;
2715 2714
2716 s->s_flags |= MS_ACTIVE; 2715 s->s_flags |= MS_ACTIVE;
2717 mnt->mnt_sb = s; 2716
2718 mnt->mnt_root = mntroot; 2717 security_free_mnt_opts(&data->lsm_opts);
2719 error = 0; 2718 nfs_free_fhandle(mntfh);
2719 return mntroot;
2720 2720
2721out: 2721out:
2722 security_free_mnt_opts(&data->lsm_opts); 2722 security_free_mnt_opts(&data->lsm_opts);
2723out_free_fh: 2723out_free_fh:
2724 nfs_free_fhandle(mntfh); 2724 nfs_free_fhandle(mntfh);
2725 return error; 2725 return ERR_PTR(error);
2726 2726
2727out_free: 2727out_free:
2728 nfs_free_server(server); 2728 nfs_free_server(server);
@@ -2968,9 +2968,9 @@ static void nfs4_kill_super(struct super_block *sb)
2968/* 2968/*
2969 * Clone an NFS4 server record on xdev traversal (FSID-change) 2969 * Clone an NFS4 server record on xdev traversal (FSID-change)
2970 */ 2970 */
2971static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, 2971static struct dentry *
2972 const char *dev_name, void *raw_data, 2972nfs4_xdev_mount(struct file_system_type *fs_type, int flags,
2973 struct vfsmount *mnt) 2973 const char *dev_name, void *raw_data)
2974{ 2974{
2975 struct nfs_clone_mount *data = raw_data; 2975 struct nfs_clone_mount *data = raw_data;
2976 struct super_block *s; 2976 struct super_block *s;
@@ -2982,7 +2982,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
2982 }; 2982 };
2983 int error; 2983 int error;
2984 2984
2985 dprintk("--> nfs4_xdev_get_sb()\n"); 2985 dprintk("--> nfs4_xdev_mount()\n");
2986 2986
2987 /* create a new volume representation */ 2987 /* create a new volume representation */
2988 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); 2988 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr);
@@ -3029,32 +3029,30 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
3029 } 3029 }
3030 3030
3031 s->s_flags |= MS_ACTIVE; 3031 s->s_flags |= MS_ACTIVE;
3032 mnt->mnt_sb = s;
3033 mnt->mnt_root = mntroot;
3034 3032
3035 security_sb_clone_mnt_opts(data->sb, s); 3033 security_sb_clone_mnt_opts(data->sb, s);
3036 3034
3037 dprintk("<-- nfs4_xdev_get_sb() = 0\n"); 3035 dprintk("<-- nfs4_xdev_mount() = 0\n");
3038 return 0; 3036 return mntroot;
3039 3037
3040out_err_nosb: 3038out_err_nosb:
3041 nfs_free_server(server); 3039 nfs_free_server(server);
3042out_err_noserver: 3040out_err_noserver:
3043 dprintk("<-- nfs4_xdev_get_sb() = %d [error]\n", error); 3041 dprintk("<-- nfs4_xdev_mount() = %d [error]\n", error);
3044 return error; 3042 return ERR_PTR(error);
3045 3043
3046error_splat_super: 3044error_splat_super:
3047 if (server && !s->s_root) 3045 if (server && !s->s_root)
3048 bdi_unregister(&server->backing_dev_info); 3046 bdi_unregister(&server->backing_dev_info);
3049error_splat_bdi: 3047error_splat_bdi:
3050 deactivate_locked_super(s); 3048 deactivate_locked_super(s);
3051 dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); 3049 dprintk("<-- nfs4_xdev_mount() = %d [splat]\n", error);
3052 return error; 3050 return ERR_PTR(error);
3053} 3051}
3054 3052
3055static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, 3053static struct dentry *
3056 int flags, const char *dev_name, void *raw_data, 3054nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags,
3057 struct vfsmount *mnt) 3055 const char *dev_name, void *raw_data)
3058{ 3056{
3059 struct nfs_clone_mount *data = raw_data; 3057 struct nfs_clone_mount *data = raw_data;
3060 struct super_block *s; 3058 struct super_block *s;
@@ -3118,14 +3116,12 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
3118 } 3116 }
3119 3117
3120 s->s_flags |= MS_ACTIVE; 3118 s->s_flags |= MS_ACTIVE;
3121 mnt->mnt_sb = s;
3122 mnt->mnt_root = mntroot;
3123 3119
3124 security_sb_clone_mnt_opts(data->sb, s); 3120 security_sb_clone_mnt_opts(data->sb, s);
3125 3121
3126 nfs_free_fhandle(mntfh); 3122 nfs_free_fhandle(mntfh);
3127 dprintk("<-- nfs4_referral_get_sb() = 0\n"); 3123 dprintk("<-- nfs4_referral_get_sb() = 0\n");
3128 return 0; 3124 return mntroot;
3129 3125
3130out_err_nosb: 3126out_err_nosb:
3131 nfs_free_server(server); 3127 nfs_free_server(server);
@@ -3133,7 +3129,7 @@ out_err_noserver:
3133 nfs_free_fhandle(mntfh); 3129 nfs_free_fhandle(mntfh);
3134out_err_nofh: 3130out_err_nofh:
3135 dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error); 3131 dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error);
3136 return error; 3132 return ERR_PTR(error);
3137 3133
3138error_splat_super: 3134error_splat_super:
3139 if (server && !s->s_root) 3135 if (server && !s->s_root)
@@ -3142,7 +3138,7 @@ error_splat_bdi:
3142 deactivate_locked_super(s); 3138 deactivate_locked_super(s);
3143 nfs_free_fhandle(mntfh); 3139 nfs_free_fhandle(mntfh);
3144 dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); 3140 dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error);
3145 return error; 3141 return ERR_PTR(error);
3146} 3142}
3147 3143
3148/* 3144/*
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 9a16bad5d2ea..7bdec8531400 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -444,9 +444,9 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
444 444
445 /* set up nfs_renamedata */ 445 /* set up nfs_renamedata */
446 data->old_dir = old_dir; 446 data->old_dir = old_dir;
447 atomic_inc(&old_dir->i_count); 447 ihold(old_dir);
448 data->new_dir = new_dir; 448 data->new_dir = new_dir;
449 atomic_inc(&new_dir->i_count); 449 ihold(new_dir);
450 data->old_dentry = dget(old_dentry); 450 data->old_dentry = dget(old_dentry);
451 data->new_dentry = dget(new_dentry); 451 data->new_dentry = dget(new_dentry);
452 nfs_fattr_init(&data->old_fattr); 452 nfs_fattr_init(&data->old_fattr);
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index d6dc3f61f8ba..4514ebbee4d6 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1405,16 +1405,16 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
1405 return simple_fill_super(sb, 0x6e667364, nfsd_files); 1405 return simple_fill_super(sb, 0x6e667364, nfsd_files);
1406} 1406}
1407 1407
1408static int nfsd_get_sb(struct file_system_type *fs_type, 1408static struct dentry *nfsd_mount(struct file_system_type *fs_type,
1409 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1409 int flags, const char *dev_name, void *data)
1410{ 1410{
1411 return get_sb_single(fs_type, flags, data, nfsd_fill_super, mnt); 1411 return mount_single(fs_type, flags, data, nfsd_fill_super);
1412} 1412}
1413 1413
1414static struct file_system_type nfsd_fs_type = { 1414static struct file_system_type nfsd_fs_type = {
1415 .owner = THIS_MODULE, 1415 .owner = THIS_MODULE,
1416 .name = "nfsd", 1416 .name = "nfsd",
1417 .get_sb = nfsd_get_sb, 1417 .mount = nfsd_mount,
1418 .kill_sb = kill_litter_super, 1418 .kill_sb = kill_litter_super,
1419}; 1419};
1420 1420
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 35ae03c0db86..f804d41ec9d3 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -1141,9 +1141,9 @@ static int nilfs_test_bdev_super(struct super_block *s, void *data)
1141 return (void *)s->s_bdev == data; 1141 return (void *)s->s_bdev == data;
1142} 1142}
1143 1143
1144static int 1144static struct dentry *
1145nilfs_get_sb(struct file_system_type *fs_type, int flags, 1145nilfs_mount(struct file_system_type *fs_type, int flags,
1146 const char *dev_name, void *data, struct vfsmount *mnt) 1146 const char *dev_name, void *data)
1147{ 1147{
1148 struct nilfs_super_data sd; 1148 struct nilfs_super_data sd;
1149 struct super_block *s; 1149 struct super_block *s;
@@ -1156,7 +1156,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
1156 1156
1157 sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type); 1157 sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type);
1158 if (IS_ERR(sd.bdev)) 1158 if (IS_ERR(sd.bdev))
1159 return PTR_ERR(sd.bdev); 1159 return ERR_CAST(sd.bdev);
1160 1160
1161 sd.cno = 0; 1161 sd.cno = 0;
1162 sd.flags = flags; 1162 sd.flags = flags;
@@ -1235,9 +1235,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
1235 if (!s_new) 1235 if (!s_new)
1236 close_bdev_exclusive(sd.bdev, mode); 1236 close_bdev_exclusive(sd.bdev, mode);
1237 1237
1238 mnt->mnt_sb = s; 1238 return root_dentry;
1239 mnt->mnt_root = root_dentry;
1240 return 0;
1241 1239
1242 failed_super: 1240 failed_super:
1243 deactivate_locked_super(s); 1241 deactivate_locked_super(s);
@@ -1245,13 +1243,13 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
1245 failed: 1243 failed:
1246 if (!s_new) 1244 if (!s_new)
1247 close_bdev_exclusive(sd.bdev, mode); 1245 close_bdev_exclusive(sd.bdev, mode);
1248 return err; 1246 return ERR_PTR(err);
1249} 1247}
1250 1248
1251struct file_system_type nilfs_fs_type = { 1249struct file_system_type nilfs_fs_type = {
1252 .owner = THIS_MODULE, 1250 .owner = THIS_MODULE,
1253 .name = "nilfs2", 1251 .name = "nilfs2",
1254 .get_sb = nilfs_get_sb, 1252 .mount = nilfs_mount,
1255 .kill_sb = kill_block_super, 1253 .kill_sb = kill_block_super,
1256 .fs_flags = FS_REQUIRES_DEV, 1254 .fs_flags = FS_REQUIRES_DEV,
1257}; 1255};
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index d3fbe5730bfc..a30ecacc01f2 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -3059,17 +3059,16 @@ struct kmem_cache *ntfs_index_ctx_cache;
3059/* Driver wide mutex. */ 3059/* Driver wide mutex. */
3060DEFINE_MUTEX(ntfs_lock); 3060DEFINE_MUTEX(ntfs_lock);
3061 3061
3062static int ntfs_get_sb(struct file_system_type *fs_type, 3062static struct dentry *ntfs_mount(struct file_system_type *fs_type,
3063 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 3063 int flags, const char *dev_name, void *data)
3064{ 3064{
3065 return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super, 3065 return mount_bdev(fs_type, flags, dev_name, data, ntfs_fill_super);
3066 mnt);
3067} 3066}
3068 3067
3069static struct file_system_type ntfs_fs_type = { 3068static struct file_system_type ntfs_fs_type = {
3070 .owner = THIS_MODULE, 3069 .owner = THIS_MODULE,
3071 .name = "ntfs", 3070 .name = "ntfs",
3072 .get_sb = ntfs_get_sb, 3071 .mount = ntfs_mount,
3073 .kill_sb = kill_block_super, 3072 .kill_sb = kill_block_super,
3074 .fs_flags = FS_REQUIRES_DEV, 3073 .fs_flags = FS_REQUIRES_DEV,
3075}; 3074};
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 75e115f1bd73..b2df490a19ed 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -643,16 +643,16 @@ static const struct inode_operations dlmfs_file_inode_operations = {
643 .setattr = dlmfs_file_setattr, 643 .setattr = dlmfs_file_setattr,
644}; 644};
645 645
646static int dlmfs_get_sb(struct file_system_type *fs_type, 646static struct dentry *dlmfs_mount(struct file_system_type *fs_type,
647 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 647 int flags, const char *dev_name, void *data)
648{ 648{
649 return get_sb_nodev(fs_type, flags, data, dlmfs_fill_super, mnt); 649 return mount_nodev(fs_type, flags, data, dlmfs_fill_super);
650} 650}
651 651
652static struct file_system_type dlmfs_fs_type = { 652static struct file_system_type dlmfs_fs_type = {
653 .owner = THIS_MODULE, 653 .owner = THIS_MODULE,
654 .name = "ocfs2_dlmfs", 654 .name = "ocfs2_dlmfs",
655 .get_sb = dlmfs_get_sb, 655 .mount = dlmfs_mount,
656 .kill_sb = kill_litter_super, 656 .kill_sb = kill_litter_super,
657}; 657};
658 658
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 56f0cb395820..f02c0ef31578 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1236,14 +1236,12 @@ read_super_error:
1236 return status; 1236 return status;
1237} 1237}
1238 1238
1239static int ocfs2_get_sb(struct file_system_type *fs_type, 1239static struct dentry *ocfs2_mount(struct file_system_type *fs_type,
1240 int flags, 1240 int flags,
1241 const char *dev_name, 1241 const char *dev_name,
1242 void *data, 1242 void *data)
1243 struct vfsmount *mnt)
1244{ 1243{
1245 return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super, 1244 return mount_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super);
1246 mnt);
1247} 1245}
1248 1246
1249static void ocfs2_kill_sb(struct super_block *sb) 1247static void ocfs2_kill_sb(struct super_block *sb)
@@ -1267,8 +1265,7 @@ out:
1267static struct file_system_type ocfs2_fs_type = { 1265static struct file_system_type ocfs2_fs_type = {
1268 .owner = THIS_MODULE, 1266 .owner = THIS_MODULE,
1269 .name = "ocfs2", 1267 .name = "ocfs2",
1270 .get_sb = ocfs2_get_sb, /* is this called when we mount 1268 .mount = ocfs2_mount,
1271 * the fs? */
1272 .kill_sb = ocfs2_kill_sb, 1269 .kill_sb = ocfs2_kill_sb,
1273 1270
1274 .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE, 1271 .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 14a22863291a..e043c4cb9a97 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -557,17 +557,16 @@ end:
557 return ret; 557 return ret;
558} 558}
559 559
560static int omfs_get_sb(struct file_system_type *fs_type, 560static struct dentry *omfs_mount(struct file_system_type *fs_type,
561 int flags, const char *dev_name, 561 int flags, const char *dev_name, void *data)
562 void *data, struct vfsmount *m)
563{ 562{
564 return get_sb_bdev(fs_type, flags, dev_name, data, omfs_fill_super, m); 563 return mount_bdev(fs_type, flags, dev_name, data, omfs_fill_super);
565} 564}
566 565
567static struct file_system_type omfs_fs_type = { 566static struct file_system_type omfs_fs_type = {
568 .owner = THIS_MODULE, 567 .owner = THIS_MODULE,
569 .name = "omfs", 568 .name = "omfs",
570 .get_sb = omfs_get_sb, 569 .mount = omfs_mount,
571 .kill_sb = kill_block_super, 570 .kill_sb = kill_block_super,
572 .fs_flags = FS_REQUIRES_DEV, 571 .fs_flags = FS_REQUIRES_DEV,
573}; 572};
diff --git a/fs/open.c b/fs/open.c
index d74e1983e8dc..4197b9ed023d 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -786,11 +786,11 @@ struct file *nameidata_to_filp(struct nameidata *nd)
786 /* Pick up the filp from the open intent */ 786 /* Pick up the filp from the open intent */
787 filp = nd->intent.open.file; 787 filp = nd->intent.open.file;
788 /* Has the filesystem initialised the file for us? */ 788 /* Has the filesystem initialised the file for us? */
789 if (filp->f_path.dentry == NULL) 789 if (filp->f_path.dentry == NULL) {
790 path_get(&nd->path);
790 filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp, 791 filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp,
791 NULL, cred); 792 NULL, cred);
792 else 793 }
793 path_put(&nd->path);
794 return filp; 794 return filp;
795} 795}
796 796
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index ffcd04f0012c..ddb1f41376e5 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -415,16 +415,16 @@ out_no_root:
415 return ret; 415 return ret;
416} 416}
417 417
418static int openprom_get_sb(struct file_system_type *fs_type, 418static struct dentry *openprom_mount(struct file_system_type *fs_type,
419 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 419 int flags, const char *dev_name, void *data)
420{ 420{
421 return get_sb_single(fs_type, flags, data, openprom_fill_super, mnt); 421 return mount_single(fs_type, flags, data, openprom_fill_super)
422} 422}
423 423
424static struct file_system_type openprom_fs_type = { 424static struct file_system_type openprom_fs_type = {
425 .owner = THIS_MODULE, 425 .owner = THIS_MODULE,
426 .name = "openpromfs", 426 .name = "openpromfs",
427 .get_sb = openprom_get_sb, 427 .mount = openprom_mount,
428 .kill_sb = kill_anon_super, 428 .kill_sb = kill_anon_super,
429}; 429};
430 430
diff --git a/fs/pipe.c b/fs/pipe.c
index d2d7566ce68e..a8012a955720 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1247,16 +1247,15 @@ out:
1247 * any operations on the root directory. However, we need a non-trivial 1247 * any operations on the root directory. However, we need a non-trivial
1248 * d_name - pipe: will go nicely and kill the special-casing in procfs. 1248 * d_name - pipe: will go nicely and kill the special-casing in procfs.
1249 */ 1249 */
1250static int pipefs_get_sb(struct file_system_type *fs_type, 1250static struct dentry *pipefs_mount(struct file_system_type *fs_type,
1251 int flags, const char *dev_name, void *data, 1251 int flags, const char *dev_name, void *data)
1252 struct vfsmount *mnt)
1253{ 1252{
1254 return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC, mnt); 1253 return mount_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC);
1255} 1254}
1256 1255
1257static struct file_system_type pipe_fs_type = { 1256static struct file_system_type pipe_fs_type = {
1258 .name = "pipefs", 1257 .name = "pipefs",
1259 .get_sb = pipefs_get_sb, 1258 .mount = pipefs_mount,
1260 .kill_sb = kill_anon_super, 1259 .kill_sb = kill_anon_super,
1261}; 1260};
1262 1261
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 93d99b316325..ef9fa8e24ad6 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -35,8 +35,8 @@ static int proc_set_super(struct super_block *sb, void *data)
35 return set_anon_super(sb, NULL); 35 return set_anon_super(sb, NULL);
36} 36}
37 37
38static int proc_get_sb(struct file_system_type *fs_type, 38static struct dentry *proc_mount(struct file_system_type *fs_type,
39 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 39 int flags, const char *dev_name, void *data)
40{ 40{
41 int err; 41 int err;
42 struct super_block *sb; 42 struct super_block *sb;
@@ -61,14 +61,14 @@ static int proc_get_sb(struct file_system_type *fs_type,
61 61
62 sb = sget(fs_type, proc_test_super, proc_set_super, ns); 62 sb = sget(fs_type, proc_test_super, proc_set_super, ns);
63 if (IS_ERR(sb)) 63 if (IS_ERR(sb))
64 return PTR_ERR(sb); 64 return ERR_CAST(sb);
65 65
66 if (!sb->s_root) { 66 if (!sb->s_root) {
67 sb->s_flags = flags; 67 sb->s_flags = flags;
68 err = proc_fill_super(sb); 68 err = proc_fill_super(sb);
69 if (err) { 69 if (err) {
70 deactivate_locked_super(sb); 70 deactivate_locked_super(sb);
71 return err; 71 return ERR_PTR(err);
72 } 72 }
73 73
74 ei = PROC_I(sb->s_root->d_inode); 74 ei = PROC_I(sb->s_root->d_inode);
@@ -79,11 +79,9 @@ static int proc_get_sb(struct file_system_type *fs_type,
79 } 79 }
80 80
81 sb->s_flags |= MS_ACTIVE; 81 sb->s_flags |= MS_ACTIVE;
82 ns->proc_mnt = mnt;
83 } 82 }
84 83
85 simple_set_mnt(mnt, sb); 84 return dget(sb->s_root);
86 return 0;
87} 85}
88 86
89static void proc_kill_sb(struct super_block *sb) 87static void proc_kill_sb(struct super_block *sb)
@@ -97,7 +95,7 @@ static void proc_kill_sb(struct super_block *sb)
97 95
98static struct file_system_type proc_fs_type = { 96static struct file_system_type proc_fs_type = {
99 .name = "proc", 97 .name = "proc",
100 .get_sb = proc_get_sb, 98 .mount = proc_mount,
101 .kill_sb = proc_kill_sb, 99 .kill_sb = proc_kill_sb,
102}; 100};
103 101
@@ -115,6 +113,7 @@ void __init proc_root_init(void)
115 return; 113 return;
116 } 114 }
117 115
116 init_pid_ns.proc_mnt = proc_mnt;
118 proc_symlink("mounts", NULL, "self/mounts"); 117 proc_symlink("mounts", NULL, "self/mounts");
119 118
120 proc_net_init(); 119 proc_net_init();
@@ -213,6 +212,7 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)
213 if (IS_ERR(mnt)) 212 if (IS_ERR(mnt))
214 return PTR_ERR(mnt); 213 return PTR_ERR(mnt);
215 214
215 ns->proc_mnt = mnt;
216 return 0; 216 return 0;
217} 217}
218 218
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 01bad30026fc..fcada42f1aa3 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -454,17 +454,16 @@ static void destroy_inodecache(void)
454 kmem_cache_destroy(qnx4_inode_cachep); 454 kmem_cache_destroy(qnx4_inode_cachep);
455} 455}
456 456
457static int qnx4_get_sb(struct file_system_type *fs_type, 457static struct dentry *qnx4_mount(struct file_system_type *fs_type,
458 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 458 int flags, const char *dev_name, void *data)
459{ 459{
460 return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super, 460 return mount_bdev(fs_type, flags, dev_name, data, qnx4_fill_super);
461 mnt);
462} 461}
463 462
464static struct file_system_type qnx4_fs_type = { 463static struct file_system_type qnx4_fs_type = {
465 .owner = THIS_MODULE, 464 .owner = THIS_MODULE,
466 .name = "qnx4", 465 .name = "qnx4",
467 .get_sb = qnx4_get_sb, 466 .mount = qnx4_mount,
468 .kill_sb = kill_block_super, 467 .kill_sb = kill_block_super,
469 .fs_flags = FS_REQUIRES_DEV, 468 .fs_flags = FS_REQUIRES_DEV,
470}; 469};
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 67fadb1ad2c1..eacb166fb259 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -255,17 +255,16 @@ fail:
255 return err; 255 return err;
256} 256}
257 257
258int ramfs_get_sb(struct file_system_type *fs_type, 258struct dentry *ramfs_mount(struct file_system_type *fs_type,
259 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 259 int flags, const char *dev_name, void *data)
260{ 260{
261 return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt); 261 return mount_nodev(fs_type, flags, data, ramfs_fill_super);
262} 262}
263 263
264static int rootfs_get_sb(struct file_system_type *fs_type, 264static struct dentry *rootfs_mount(struct file_system_type *fs_type,
265 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 265 int flags, const char *dev_name, void *data)
266{ 266{
267 return get_sb_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super, 267 return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super);
268 mnt);
269} 268}
270 269
271static void ramfs_kill_sb(struct super_block *sb) 270static void ramfs_kill_sb(struct super_block *sb)
@@ -276,12 +275,12 @@ static void ramfs_kill_sb(struct super_block *sb)
276 275
277static struct file_system_type ramfs_fs_type = { 276static struct file_system_type ramfs_fs_type = {
278 .name = "ramfs", 277 .name = "ramfs",
279 .get_sb = ramfs_get_sb, 278 .mount = ramfs_mount,
280 .kill_sb = ramfs_kill_sb, 279 .kill_sb = ramfs_kill_sb,
281}; 280};
282static struct file_system_type rootfs_fs_type = { 281static struct file_system_type rootfs_fs_type = {
283 .name = "rootfs", 282 .name = "rootfs",
284 .get_sb = rootfs_get_sb, 283 .mount = rootfs_mount,
285 .kill_sb = kill_litter_super, 284 .kill_sb = kill_litter_super,
286}; 285};
287 286
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index e15ff612002d..3bf7a6457f4d 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2213,12 +2213,11 @@ out:
2213 2213
2214#endif 2214#endif
2215 2215
2216static int get_super_block(struct file_system_type *fs_type, 2216static struct dentry *get_super_block(struct file_system_type *fs_type,
2217 int flags, const char *dev_name, 2217 int flags, const char *dev_name,
2218 void *data, struct vfsmount *mnt) 2218 void *data)
2219{ 2219{
2220 return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super, 2220 return mount_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super);
2221 mnt);
2222} 2221}
2223 2222
2224static int __init init_reiserfs_fs(void) 2223static int __init init_reiserfs_fs(void)
@@ -2253,7 +2252,7 @@ static void __exit exit_reiserfs_fs(void)
2253struct file_system_type reiserfs_fs_type = { 2252struct file_system_type reiserfs_fs_type = {
2254 .owner = THIS_MODULE, 2253 .owner = THIS_MODULE,
2255 .name = "reiserfs", 2254 .name = "reiserfs",
2256 .get_sb = get_super_block, 2255 .mount = get_super_block,
2257 .kill_sb = reiserfs_kill_sb, 2256 .kill_sb = reiserfs_kill_sb,
2258 .fs_flags = FS_REQUIRES_DEV, 2257 .fs_flags = FS_REQUIRES_DEV,
2259}; 2258};
diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index 268580535c92..6647f90e55cd 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -552,20 +552,19 @@ error_rsb:
552/* 552/*
553 * get a superblock for mounting 553 * get a superblock for mounting
554 */ 554 */
555static int romfs_get_sb(struct file_system_type *fs_type, 555static struct dentry *romfs_mount(struct file_system_type *fs_type,
556 int flags, const char *dev_name, 556 int flags, const char *dev_name,
557 void *data, struct vfsmount *mnt) 557 void *data)
558{ 558{
559 int ret = -EINVAL; 559 struct dentry *ret = ERR_PTR(-EINVAL);
560 560
561#ifdef CONFIG_ROMFS_ON_MTD 561#ifdef CONFIG_ROMFS_ON_MTD
562 ret = get_sb_mtd(fs_type, flags, dev_name, data, romfs_fill_super, 562 ret = mount_mtd(fs_type, flags, dev_name, data, romfs_fill_super);
563 mnt);
564#endif 563#endif
565#ifdef CONFIG_ROMFS_ON_BLOCK 564#ifdef CONFIG_ROMFS_ON_BLOCK
566 if (ret == -EINVAL) 565 if (ret == ERR_PTR(-EINVAL))
567 ret = get_sb_bdev(fs_type, flags, dev_name, data, 566 ret = mount_bdev(fs_type, flags, dev_name, data,
568 romfs_fill_super, mnt); 567 romfs_fill_super);
569#endif 568#endif
570 return ret; 569 return ret;
571} 570}
@@ -592,7 +591,7 @@ static void romfs_kill_sb(struct super_block *sb)
592static struct file_system_type romfs_fs_type = { 591static struct file_system_type romfs_fs_type = {
593 .owner = THIS_MODULE, 592 .owner = THIS_MODULE,
594 .name = "romfs", 593 .name = "romfs",
595 .get_sb = romfs_get_sb, 594 .mount = romfs_mount,
596 .kill_sb = romfs_kill_sb, 595 .kill_sb = romfs_kill_sb,
597 .fs_flags = FS_REQUIRES_DEV, 596 .fs_flags = FS_REQUIRES_DEV,
598}; 597};
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 07a4f1156048..24de30ba34c1 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -370,12 +370,10 @@ static void squashfs_put_super(struct super_block *sb)
370} 370}
371 371
372 372
373static int squashfs_get_sb(struct file_system_type *fs_type, int flags, 373static struct dentry *squashfs_mount(struct file_system_type *fs_type, int flags,
374 const char *dev_name, void *data, 374 const char *dev_name, void *data)
375 struct vfsmount *mnt)
376{ 375{
377 return get_sb_bdev(fs_type, flags, dev_name, data, squashfs_fill_super, 376 return mount_bdev(fs_type, flags, dev_name, data, squashfs_fill_super);
378 mnt);
379} 377}
380 378
381 379
@@ -451,7 +449,7 @@ static void squashfs_destroy_inode(struct inode *inode)
451static struct file_system_type squashfs_fs_type = { 449static struct file_system_type squashfs_fs_type = {
452 .owner = THIS_MODULE, 450 .owner = THIS_MODULE,
453 .name = "squashfs", 451 .name = "squashfs",
454 .get_sb = squashfs_get_sb, 452 .mount = squashfs_mount,
455 .kill_sb = kill_block_super, 453 .kill_sb = kill_block_super,
456 .fs_flags = FS_REQUIRES_DEV 454 .fs_flags = FS_REQUIRES_DEV
457}; 455};
diff --git a/fs/super.c b/fs/super.c
index b9c9869165db..ca696155cd9a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -715,15 +715,14 @@ static int ns_set_super(struct super_block *sb, void *data)
715 return set_anon_super(sb, NULL); 715 return set_anon_super(sb, NULL);
716} 716}
717 717
718int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, 718struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
719 int (*fill_super)(struct super_block *, void *, int), 719 void *data, int (*fill_super)(struct super_block *, void *, int))
720 struct vfsmount *mnt)
721{ 720{
722 struct super_block *sb; 721 struct super_block *sb;
723 722
724 sb = sget(fs_type, ns_test_super, ns_set_super, data); 723 sb = sget(fs_type, ns_test_super, ns_set_super, data);
725 if (IS_ERR(sb)) 724 if (IS_ERR(sb))
726 return PTR_ERR(sb); 725 return ERR_CAST(sb);
727 726
728 if (!sb->s_root) { 727 if (!sb->s_root) {
729 int err; 728 int err;
@@ -731,17 +730,16 @@ int get_sb_ns(struct file_system_type *fs_type, int flags, void *data,
731 err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); 730 err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
732 if (err) { 731 if (err) {
733 deactivate_locked_super(sb); 732 deactivate_locked_super(sb);
734 return err; 733 return ERR_PTR(err);
735 } 734 }
736 735
737 sb->s_flags |= MS_ACTIVE; 736 sb->s_flags |= MS_ACTIVE;
738 } 737 }
739 738
740 simple_set_mnt(mnt, sb); 739 return dget(sb->s_root);
741 return 0;
742} 740}
743 741
744EXPORT_SYMBOL(get_sb_ns); 742EXPORT_SYMBOL(mount_ns);
745 743
746#ifdef CONFIG_BLOCK 744#ifdef CONFIG_BLOCK
747static int set_bdev_super(struct super_block *s, void *data) 745static int set_bdev_super(struct super_block *s, void *data)
@@ -762,10 +760,9 @@ static int test_bdev_super(struct super_block *s, void *data)
762 return (void *)s->s_bdev == data; 760 return (void *)s->s_bdev == data;
763} 761}
764 762
765int get_sb_bdev(struct file_system_type *fs_type, 763struct dentry *mount_bdev(struct file_system_type *fs_type,
766 int flags, const char *dev_name, void *data, 764 int flags, const char *dev_name, void *data,
767 int (*fill_super)(struct super_block *, void *, int), 765 int (*fill_super)(struct super_block *, void *, int))
768 struct vfsmount *mnt)
769{ 766{
770 struct block_device *bdev; 767 struct block_device *bdev;
771 struct super_block *s; 768 struct super_block *s;
@@ -777,7 +774,7 @@ int get_sb_bdev(struct file_system_type *fs_type,
777 774
778 bdev = open_bdev_exclusive(dev_name, mode, fs_type); 775 bdev = open_bdev_exclusive(dev_name, mode, fs_type);
779 if (IS_ERR(bdev)) 776 if (IS_ERR(bdev))
780 return PTR_ERR(bdev); 777 return ERR_CAST(bdev);
781 778
782 /* 779 /*
783 * once the super is inserted into the list by sget, s_umount 780 * once the super is inserted into the list by sget, s_umount
@@ -829,15 +826,30 @@ int get_sb_bdev(struct file_system_type *fs_type,
829 bdev->bd_super = s; 826 bdev->bd_super = s;
830 } 827 }
831 828
832 simple_set_mnt(mnt, s); 829 return dget(s->s_root);
833 return 0;
834 830
835error_s: 831error_s:
836 error = PTR_ERR(s); 832 error = PTR_ERR(s);
837error_bdev: 833error_bdev:
838 close_bdev_exclusive(bdev, mode); 834 close_bdev_exclusive(bdev, mode);
839error: 835error:
840 return error; 836 return ERR_PTR(error);
837}
838EXPORT_SYMBOL(mount_bdev);
839
840int get_sb_bdev(struct file_system_type *fs_type,
841 int flags, const char *dev_name, void *data,
842 int (*fill_super)(struct super_block *, void *, int),
843 struct vfsmount *mnt)
844{
845 struct dentry *root;
846
847 root = mount_bdev(fs_type, flags, dev_name, data, fill_super);
848 if (IS_ERR(root))
849 return PTR_ERR(root);
850 mnt->mnt_root = root;
851 mnt->mnt_sb = root->d_sb;
852 return 0;
841} 853}
842 854
843EXPORT_SYMBOL(get_sb_bdev); 855EXPORT_SYMBOL(get_sb_bdev);
@@ -856,29 +868,42 @@ void kill_block_super(struct super_block *sb)
856EXPORT_SYMBOL(kill_block_super); 868EXPORT_SYMBOL(kill_block_super);
857#endif 869#endif
858 870
859int get_sb_nodev(struct file_system_type *fs_type, 871struct dentry *mount_nodev(struct file_system_type *fs_type,
860 int flags, void *data, 872 int flags, void *data,
861 int (*fill_super)(struct super_block *, void *, int), 873 int (*fill_super)(struct super_block *, void *, int))
862 struct vfsmount *mnt)
863{ 874{
864 int error; 875 int error;
865 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); 876 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
866 877
867 if (IS_ERR(s)) 878 if (IS_ERR(s))
868 return PTR_ERR(s); 879 return ERR_CAST(s);
869 880
870 s->s_flags = flags; 881 s->s_flags = flags;
871 882
872 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 883 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
873 if (error) { 884 if (error) {
874 deactivate_locked_super(s); 885 deactivate_locked_super(s);
875 return error; 886 return ERR_PTR(error);
876 } 887 }
877 s->s_flags |= MS_ACTIVE; 888 s->s_flags |= MS_ACTIVE;
878 simple_set_mnt(mnt, s); 889 return dget(s->s_root);
879 return 0;
880} 890}
891EXPORT_SYMBOL(mount_nodev);
881 892
893int get_sb_nodev(struct file_system_type *fs_type,
894 int flags, void *data,
895 int (*fill_super)(struct super_block *, void *, int),
896 struct vfsmount *mnt)
897{
898 struct dentry *root;
899
900 root = mount_nodev(fs_type, flags, data, fill_super);
901 if (IS_ERR(root))
902 return PTR_ERR(root);
903 mnt->mnt_root = root;
904 mnt->mnt_sb = root->d_sb;
905 return 0;
906}
882EXPORT_SYMBOL(get_sb_nodev); 907EXPORT_SYMBOL(get_sb_nodev);
883 908
884static int compare_single(struct super_block *s, void *p) 909static int compare_single(struct super_block *s, void *p)
@@ -886,29 +911,42 @@ static int compare_single(struct super_block *s, void *p)
886 return 1; 911 return 1;
887} 912}
888 913
889int get_sb_single(struct file_system_type *fs_type, 914struct dentry *mount_single(struct file_system_type *fs_type,
890 int flags, void *data, 915 int flags, void *data,
891 int (*fill_super)(struct super_block *, void *, int), 916 int (*fill_super)(struct super_block *, void *, int))
892 struct vfsmount *mnt)
893{ 917{
894 struct super_block *s; 918 struct super_block *s;
895 int error; 919 int error;
896 920
897 s = sget(fs_type, compare_single, set_anon_super, NULL); 921 s = sget(fs_type, compare_single, set_anon_super, NULL);
898 if (IS_ERR(s)) 922 if (IS_ERR(s))
899 return PTR_ERR(s); 923 return ERR_CAST(s);
900 if (!s->s_root) { 924 if (!s->s_root) {
901 s->s_flags = flags; 925 s->s_flags = flags;
902 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 926 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
903 if (error) { 927 if (error) {
904 deactivate_locked_super(s); 928 deactivate_locked_super(s);
905 return error; 929 return ERR_PTR(error);
906 } 930 }
907 s->s_flags |= MS_ACTIVE; 931 s->s_flags |= MS_ACTIVE;
908 } else { 932 } else {
909 do_remount_sb(s, flags, data, 0); 933 do_remount_sb(s, flags, data, 0);
910 } 934 }
911 simple_set_mnt(mnt, s); 935 return dget(s->s_root);
936}
937EXPORT_SYMBOL(mount_single);
938
939int get_sb_single(struct file_system_type *fs_type,
940 int flags, void *data,
941 int (*fill_super)(struct super_block *, void *, int),
942 struct vfsmount *mnt)
943{
944 struct dentry *root;
945 root = mount_single(fs_type, flags, data, fill_super);
946 if (IS_ERR(root))
947 return PTR_ERR(root);
948 mnt->mnt_root = root;
949 mnt->mnt_sb = root->d_sb;
912 return 0; 950 return 0;
913} 951}
914 952
@@ -918,6 +956,7 @@ struct vfsmount *
918vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data) 956vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
919{ 957{
920 struct vfsmount *mnt; 958 struct vfsmount *mnt;
959 struct dentry *root;
921 char *secdata = NULL; 960 char *secdata = NULL;
922 int error; 961 int error;
923 962
@@ -942,9 +981,19 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
942 goto out_free_secdata; 981 goto out_free_secdata;
943 } 982 }
944 983
945 error = type->get_sb(type, flags, name, data, mnt); 984 if (type->mount) {
946 if (error < 0) 985 root = type->mount(type, flags, name, data);
947 goto out_free_secdata; 986 if (IS_ERR(root)) {
987 error = PTR_ERR(root);
988 goto out_free_secdata;
989 }
990 mnt->mnt_root = root;
991 mnt->mnt_sb = root->d_sb;
992 } else {
993 error = type->get_sb(type, flags, name, data, mnt);
994 if (error < 0)
995 goto out_free_secdata;
996 }
948 BUG_ON(!mnt->mnt_sb); 997 BUG_ON(!mnt->mnt_sb);
949 WARN_ON(!mnt->mnt_sb->s_bdi); 998 WARN_ON(!mnt->mnt_sb->s_bdi);
950 mnt->mnt_sb->s_flags |= MS_BORN; 999 mnt->mnt_sb->s_flags |= MS_BORN;
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index f2af22574c50..266895783b47 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -23,7 +23,7 @@
23#include "sysfs.h" 23#include "sysfs.h"
24 24
25 25
26static struct vfsmount *sysfs_mount; 26static struct vfsmount *sysfs_mnt;
27struct kmem_cache *sysfs_dir_cachep; 27struct kmem_cache *sysfs_dir_cachep;
28 28
29static const struct super_operations sysfs_ops = { 29static const struct super_operations sysfs_ops = {
@@ -95,18 +95,17 @@ static int sysfs_set_super(struct super_block *sb, void *data)
95 return error; 95 return error;
96} 96}
97 97
98static int sysfs_get_sb(struct file_system_type *fs_type, 98static struct dentry *sysfs_mount(struct file_system_type *fs_type,
99 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 99 int flags, const char *dev_name, void *data)
100{ 100{
101 struct sysfs_super_info *info; 101 struct sysfs_super_info *info;
102 enum kobj_ns_type type; 102 enum kobj_ns_type type;
103 struct super_block *sb; 103 struct super_block *sb;
104 int error; 104 int error;
105 105
106 error = -ENOMEM;
107 info = kzalloc(sizeof(*info), GFP_KERNEL); 106 info = kzalloc(sizeof(*info), GFP_KERNEL);
108 if (!info) 107 if (!info)
109 goto out; 108 return ERR_PTR(-ENOMEM);
110 109
111 for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++) 110 for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++)
112 info->ns[type] = kobj_ns_current(type); 111 info->ns[type] = kobj_ns_current(type);
@@ -114,24 +113,19 @@ static int sysfs_get_sb(struct file_system_type *fs_type,
114 sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info); 113 sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info);
115 if (IS_ERR(sb) || sb->s_fs_info != info) 114 if (IS_ERR(sb) || sb->s_fs_info != info)
116 kfree(info); 115 kfree(info);
117 if (IS_ERR(sb)) { 116 if (IS_ERR(sb))
118 error = PTR_ERR(sb); 117 return ERR_CAST(sb);
119 goto out;
120 }
121 if (!sb->s_root) { 118 if (!sb->s_root) {
122 sb->s_flags = flags; 119 sb->s_flags = flags;
123 error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); 120 error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
124 if (error) { 121 if (error) {
125 deactivate_locked_super(sb); 122 deactivate_locked_super(sb);
126 goto out; 123 return ERR_PTR(error);
127 } 124 }
128 sb->s_flags |= MS_ACTIVE; 125 sb->s_flags |= MS_ACTIVE;
129 } 126 }
130 127
131 simple_set_mnt(mnt, sb); 128 return dget(sb->s_root);
132 error = 0;
133out:
134 return error;
135} 129}
136 130
137static void sysfs_kill_sb(struct super_block *sb) 131static void sysfs_kill_sb(struct super_block *sb)
@@ -147,7 +141,7 @@ static void sysfs_kill_sb(struct super_block *sb)
147 141
148static struct file_system_type sysfs_fs_type = { 142static struct file_system_type sysfs_fs_type = {
149 .name = "sysfs", 143 .name = "sysfs",
150 .get_sb = sysfs_get_sb, 144 .mount = sysfs_mount,
151 .kill_sb = sysfs_kill_sb, 145 .kill_sb = sysfs_kill_sb,
152}; 146};
153 147
@@ -189,11 +183,11 @@ int __init sysfs_init(void)
189 183
190 err = register_filesystem(&sysfs_fs_type); 184 err = register_filesystem(&sysfs_fs_type);
191 if (!err) { 185 if (!err) {
192 sysfs_mount = kern_mount(&sysfs_fs_type); 186 sysfs_mnt = kern_mount(&sysfs_fs_type);
193 if (IS_ERR(sysfs_mount)) { 187 if (IS_ERR(sysfs_mnt)) {
194 printk(KERN_ERR "sysfs: could not mount!\n"); 188 printk(KERN_ERR "sysfs: could not mount!\n");
195 err = PTR_ERR(sysfs_mount); 189 err = PTR_ERR(sysfs_mnt);
196 sysfs_mount = NULL; 190 sysfs_mnt = NULL;
197 unregister_filesystem(&sysfs_fs_type); 191 unregister_filesystem(&sysfs_fs_type);
198 goto out_err; 192 goto out_err;
199 } 193 }
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index a0b0cda6927e..3d9c62be0c10 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -526,23 +526,22 @@ failed:
526 526
527/* Every kernel module contains stuff like this. */ 527/* Every kernel module contains stuff like this. */
528 528
529static int sysv_get_sb(struct file_system_type *fs_type, 529static struct dentry *sysv_mount(struct file_system_type *fs_type,
530 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 530 int flags, const char *dev_name, void *data)
531{ 531{
532 return get_sb_bdev(fs_type, flags, dev_name, data, sysv_fill_super, 532 return mount_bdev(fs_type, flags, dev_name, data, sysv_fill_super);
533 mnt);
534} 533}
535 534
536static int v7_get_sb(struct file_system_type *fs_type, 535static struct dentry *v7_mount(struct file_system_type *fs_type,
537 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 536 int flags, const char *dev_name, void *data)
538{ 537{
539 return get_sb_bdev(fs_type, flags, dev_name, data, v7_fill_super, mnt); 538 return mount_bdev(fs_type, flags, dev_name, data, v7_fill_super);
540} 539}
541 540
542static struct file_system_type sysv_fs_type = { 541static struct file_system_type sysv_fs_type = {
543 .owner = THIS_MODULE, 542 .owner = THIS_MODULE,
544 .name = "sysv", 543 .name = "sysv",
545 .get_sb = sysv_get_sb, 544 .mount = sysv_mount,
546 .kill_sb = kill_block_super, 545 .kill_sb = kill_block_super,
547 .fs_flags = FS_REQUIRES_DEV, 546 .fs_flags = FS_REQUIRES_DEV,
548}; 547};
@@ -550,7 +549,7 @@ static struct file_system_type sysv_fs_type = {
550static struct file_system_type v7_fs_type = { 549static struct file_system_type v7_fs_type = {
551 .owner = THIS_MODULE, 550 .owner = THIS_MODULE,
552 .name = "v7", 551 .name = "v7",
553 .get_sb = v7_get_sb, 552 .mount = v7_mount,
554 .kill_sb = kill_block_super, 553 .kill_sb = kill_block_super,
555 .fs_flags = FS_REQUIRES_DEV, 554 .fs_flags = FS_REQUIRES_DEV,
556}; 555};
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 9a47c9f0ad07..91fac54c70e3 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2038,8 +2038,8 @@ static int sb_test(struct super_block *sb, void *data)
2038 return c->vi.cdev == *dev; 2038 return c->vi.cdev == *dev;
2039} 2039}
2040 2040
2041static int ubifs_get_sb(struct file_system_type *fs_type, int flags, 2041static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
2042 const char *name, void *data, struct vfsmount *mnt) 2042 const char *name, void *data)
2043{ 2043{
2044 struct ubi_volume_desc *ubi; 2044 struct ubi_volume_desc *ubi;
2045 struct ubi_volume_info vi; 2045 struct ubi_volume_info vi;
@@ -2057,7 +2057,7 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags,
2057 if (IS_ERR(ubi)) { 2057 if (IS_ERR(ubi)) {
2058 dbg_err("cannot open \"%s\", error %d", 2058 dbg_err("cannot open \"%s\", error %d",
2059 name, (int)PTR_ERR(ubi)); 2059 name, (int)PTR_ERR(ubi));
2060 return PTR_ERR(ubi); 2060 return ERR_CAST(ubi);
2061 } 2061 }
2062 ubi_get_volume_info(ubi, &vi); 2062 ubi_get_volume_info(ubi, &vi);
2063 2063
@@ -2095,20 +2095,19 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags,
2095 /* 'fill_super()' opens ubi again so we must close it here */ 2095 /* 'fill_super()' opens ubi again so we must close it here */
2096 ubi_close_volume(ubi); 2096 ubi_close_volume(ubi);
2097 2097
2098 simple_set_mnt(mnt, sb); 2098 return dget(sb->s_root);
2099 return 0;
2100 2099
2101out_deact: 2100out_deact:
2102 deactivate_locked_super(sb); 2101 deactivate_locked_super(sb);
2103out_close: 2102out_close:
2104 ubi_close_volume(ubi); 2103 ubi_close_volume(ubi);
2105 return err; 2104 return ERR_PTR(err);
2106} 2105}
2107 2106
2108static struct file_system_type ubifs_fs_type = { 2107static struct file_system_type ubifs_fs_type = {
2109 .name = "ubifs", 2108 .name = "ubifs",
2110 .owner = THIS_MODULE, 2109 .owner = THIS_MODULE,
2111 .get_sb = ubifs_get_sb, 2110 .mount = ubifs_mount,
2112 .kill_sb = kill_anon_super, 2111 .kill_sb = kill_anon_super,
2113}; 2112};
2114 2113
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 76f3d6d97b40..4a5c7c61836a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -107,17 +107,16 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi)
107} 107}
108 108
109/* UDF filesystem type */ 109/* UDF filesystem type */
110static int udf_get_sb(struct file_system_type *fs_type, 110static struct dentry *udf_mount(struct file_system_type *fs_type,
111 int flags, const char *dev_name, void *data, 111 int flags, const char *dev_name, void *data)
112 struct vfsmount *mnt)
113{ 112{
114 return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super, mnt); 113 return mount_bdev(fs_type, flags, dev_name, data, udf_fill_super);
115} 114}
116 115
117static struct file_system_type udf_fstype = { 116static struct file_system_type udf_fstype = {
118 .owner = THIS_MODULE, 117 .owner = THIS_MODULE,
119 .name = "udf", 118 .name = "udf",
120 .get_sb = udf_get_sb, 119 .mount = udf_mount,
121 .kill_sb = kill_block_super, 120 .kill_sb = kill_block_super,
122 .fs_flags = FS_REQUIRES_DEV, 121 .fs_flags = FS_REQUIRES_DEV,
123}; 122};
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 6b9be90dae7d..2c47daed56da 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1454,16 +1454,16 @@ static const struct super_operations ufs_super_ops = {
1454 .show_options = ufs_show_options, 1454 .show_options = ufs_show_options,
1455}; 1455};
1456 1456
1457static int ufs_get_sb(struct file_system_type *fs_type, 1457static struct dentry *ufs_mount(struct file_system_type *fs_type,
1458 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1458 int flags, const char *dev_name, void *data)
1459{ 1459{
1460 return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super, mnt); 1460 return mount_bdev(fs_type, flags, dev_name, data, ufs_fill_super);
1461} 1461}
1462 1462
1463static struct file_system_type ufs_fs_type = { 1463static struct file_system_type ufs_fs_type = {
1464 .owner = THIS_MODULE, 1464 .owner = THIS_MODULE,
1465 .name = "ufs", 1465 .name = "ufs",
1466 .get_sb = ufs_get_sb, 1466 .mount = ufs_mount,
1467 .kill_sb = kill_block_super, 1467 .kill_sb = kill_block_super,
1468 .fs_flags = FS_REQUIRES_DEV, 1468 .fs_flags = FS_REQUIRES_DEV,
1469}; 1469};
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index cf808782c065..9f3a78fe6ae4 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1609,16 +1609,14 @@ xfs_fs_fill_super(
1609 goto out_free_sb; 1609 goto out_free_sb;
1610} 1610}
1611 1611
1612STATIC int 1612STATIC struct dentry *
1613xfs_fs_get_sb( 1613xfs_fs_mount(
1614 struct file_system_type *fs_type, 1614 struct file_system_type *fs_type,
1615 int flags, 1615 int flags,
1616 const char *dev_name, 1616 const char *dev_name,
1617 void *data, 1617 void *data)
1618 struct vfsmount *mnt)
1619{ 1618{
1620 return get_sb_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super, 1619 return mount_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super);
1621 mnt);
1622} 1620}
1623 1621
1624static const struct super_operations xfs_super_operations = { 1622static const struct super_operations xfs_super_operations = {
@@ -1639,7 +1637,7 @@ static const struct super_operations xfs_super_operations = {
1639static struct file_system_type xfs_fs_type = { 1637static struct file_system_type xfs_fs_type = {
1640 .owner = THIS_MODULE, 1638 .owner = THIS_MODULE,
1641 .name = "xfs", 1639 .name = "xfs",
1642 .get_sb = xfs_fs_get_sb, 1640 .mount = xfs_fs_mount,
1643 .kill_sb = kill_block_super, 1641 .kill_sb = kill_block_super,
1644 .fs_flags = FS_REQUIRES_DEV, 1642 .fs_flags = FS_REQUIRES_DEV,
1645}; 1643};
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1c73b50e81ff..4d07902bc50c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1772,6 +1772,8 @@ struct file_system_type {
1772 int fs_flags; 1772 int fs_flags;
1773 int (*get_sb) (struct file_system_type *, int, 1773 int (*get_sb) (struct file_system_type *, int,
1774 const char *, void *, struct vfsmount *); 1774 const char *, void *, struct vfsmount *);
1775 struct dentry *(*mount) (struct file_system_type *, int,
1776 const char *, void *);
1775 void (*kill_sb) (struct super_block *); 1777 void (*kill_sb) (struct super_block *);
1776 struct module *owner; 1778 struct module *owner;
1777 struct file_system_type * next; 1779 struct file_system_type * next;
@@ -1787,17 +1789,25 @@ struct file_system_type {
1787 struct lock_class_key i_alloc_sem_key; 1789 struct lock_class_key i_alloc_sem_key;
1788}; 1790};
1789 1791
1790extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, 1792extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
1791 int (*fill_super)(struct super_block *, void *, int), 1793 void *data, int (*fill_super)(struct super_block *, void *, int));
1792 struct vfsmount *mnt); 1794extern struct dentry *mount_bdev(struct file_system_type *fs_type,
1795 int flags, const char *dev_name, void *data,
1796 int (*fill_super)(struct super_block *, void *, int));
1793extern int get_sb_bdev(struct file_system_type *fs_type, 1797extern int get_sb_bdev(struct file_system_type *fs_type,
1794 int flags, const char *dev_name, void *data, 1798 int flags, const char *dev_name, void *data,
1795 int (*fill_super)(struct super_block *, void *, int), 1799 int (*fill_super)(struct super_block *, void *, int),
1796 struct vfsmount *mnt); 1800 struct vfsmount *mnt);
1801extern struct dentry *mount_single(struct file_system_type *fs_type,
1802 int flags, void *data,
1803 int (*fill_super)(struct super_block *, void *, int));
1797extern int get_sb_single(struct file_system_type *fs_type, 1804extern int get_sb_single(struct file_system_type *fs_type,
1798 int flags, void *data, 1805 int flags, void *data,
1799 int (*fill_super)(struct super_block *, void *, int), 1806 int (*fill_super)(struct super_block *, void *, int),
1800 struct vfsmount *mnt); 1807 struct vfsmount *mnt);
1808extern struct dentry *mount_nodev(struct file_system_type *fs_type,
1809 int flags, void *data,
1810 int (*fill_super)(struct super_block *, void *, int));
1801extern int get_sb_nodev(struct file_system_type *fs_type, 1811extern int get_sb_nodev(struct file_system_type *fs_type,
1802 int flags, void *data, 1812 int flags, void *data,
1803 int (*fill_super)(struct super_block *, void *, int), 1813 int (*fill_super)(struct super_block *, void *, int),
@@ -1813,9 +1823,8 @@ struct super_block *sget(struct file_system_type *type,
1813 int (*test)(struct super_block *,void *), 1823 int (*test)(struct super_block *,void *),
1814 int (*set)(struct super_block *,void *), 1824 int (*set)(struct super_block *,void *),
1815 void *data); 1825 void *data);
1816extern int get_sb_pseudo(struct file_system_type *, char *, 1826extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1817 const struct super_operations *ops, unsigned long, 1827 const struct super_operations *ops, unsigned long);
1818 struct vfsmount *mnt);
1819extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1828extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1820 1829
1821static inline void sb_mark_dirty(struct super_block *sb) 1830static inline void sb_mark_dirty(struct super_block *sb)
diff --git a/include/linux/mtd/super.h b/include/linux/mtd/super.h
index 4016dd6fe336..f456230f9330 100644
--- a/include/linux/mtd/super.h
+++ b/include/linux/mtd/super.h
@@ -18,10 +18,9 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/mount.h> 19#include <linux/mount.h>
20 20
21extern int get_sb_mtd(struct file_system_type *fs_type, int flags, 21extern struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,
22 const char *dev_name, void *data, 22 const char *dev_name, void *data,
23 int (*fill_super)(struct super_block *, void *, int), 23 int (*fill_super)(struct super_block *, void *, int));
24 struct vfsmount *mnt);
25extern void kill_mtd_super(struct super_block *sb); 24extern void kill_mtd_super(struct super_block *sb);
26 25
27 26
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index e7320b5e82fb..3a8f0c9b2933 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -3,8 +3,8 @@
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev); 5 int mode, dev_t dev);
6extern int ramfs_get_sb(struct file_system_type *fs_type, 6extern struct dentry *ramfs_mount(struct file_system_type *fs_type,
7 int flags, const char *dev_name, void *data, struct vfsmount *mnt); 7 int flags, const char *dev_name, void *data);
8 8
9#ifndef CONFIG_MMU 9#ifndef CONFIG_MMU
10extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); 10extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 3a61ffefe884..035f4399edbc 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -211,13 +211,13 @@ out:
211 return error; 211 return error;
212} 212}
213 213
214static int mqueue_get_sb(struct file_system_type *fs_type, 214static struct dentry *mqueue_mount(struct file_system_type *fs_type,
215 int flags, const char *dev_name, 215 int flags, const char *dev_name,
216 void *data, struct vfsmount *mnt) 216 void *data)
217{ 217{
218 if (!(flags & MS_KERNMOUNT)) 218 if (!(flags & MS_KERNMOUNT))
219 data = current->nsproxy->ipc_ns; 219 data = current->nsproxy->ipc_ns;
220 return get_sb_ns(fs_type, flags, data, mqueue_fill_super, mnt); 220 return mount_ns(fs_type, flags, data, mqueue_fill_super);
221} 221}
222 222
223static void init_once(void *foo) 223static void init_once(void *foo)
@@ -1232,7 +1232,7 @@ static const struct super_operations mqueue_super_ops = {
1232 1232
1233static struct file_system_type mqueue_fs_type = { 1233static struct file_system_type mqueue_fs_type = {
1234 .name = "mqueue", 1234 .name = "mqueue",
1235 .get_sb = mqueue_get_sb, 1235 .mount = mqueue_mount,
1236 .kill_sb = kill_litter_super, 1236 .kill_sb = kill_litter_super,
1237}; 1237};
1238 1238
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5cf366965d0c..66a416b42c18 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1460,9 +1460,9 @@ static int cgroup_get_rootdir(struct super_block *sb)
1460 return 0; 1460 return 0;
1461} 1461}
1462 1462
1463static int cgroup_get_sb(struct file_system_type *fs_type, 1463static struct dentry *cgroup_mount(struct file_system_type *fs_type,
1464 int flags, const char *unused_dev_name, 1464 int flags, const char *unused_dev_name,
1465 void *data, struct vfsmount *mnt) 1465 void *data)
1466{ 1466{
1467 struct cgroup_sb_opts opts; 1467 struct cgroup_sb_opts opts;
1468 struct cgroupfs_root *root; 1468 struct cgroupfs_root *root;
@@ -1596,10 +1596,9 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
1596 drop_parsed_module_refcounts(opts.subsys_bits); 1596 drop_parsed_module_refcounts(opts.subsys_bits);
1597 } 1597 }
1598 1598
1599 simple_set_mnt(mnt, sb);
1600 kfree(opts.release_agent); 1599 kfree(opts.release_agent);
1601 kfree(opts.name); 1600 kfree(opts.name);
1602 return 0; 1601 return dget(sb->s_root);
1603 1602
1604 drop_new_super: 1603 drop_new_super:
1605 deactivate_locked_super(sb); 1604 deactivate_locked_super(sb);
@@ -1608,7 +1607,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
1608 out_err: 1607 out_err:
1609 kfree(opts.release_agent); 1608 kfree(opts.release_agent);
1610 kfree(opts.name); 1609 kfree(opts.name);
1611 return ret; 1610 return ERR_PTR(ret);
1612} 1611}
1613 1612
1614static void cgroup_kill_sb(struct super_block *sb) { 1613static void cgroup_kill_sb(struct super_block *sb) {
@@ -1658,7 +1657,7 @@ static void cgroup_kill_sb(struct super_block *sb) {
1658 1657
1659static struct file_system_type cgroup_fs_type = { 1658static struct file_system_type cgroup_fs_type = {
1660 .name = "cgroup", 1659 .name = "cgroup",
1661 .get_sb = cgroup_get_sb, 1660 .mount = cgroup_mount,
1662 .kill_sb = cgroup_kill_sb, 1661 .kill_sb = cgroup_kill_sb,
1663}; 1662};
1664 1663
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 51b143e2a07a..4349935c2ad8 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -231,18 +231,17 @@ static DEFINE_SPINLOCK(cpuset_buffer_lock);
231 * users. If someone tries to mount the "cpuset" filesystem, we 231 * users. If someone tries to mount the "cpuset" filesystem, we
232 * silently switch it to mount "cgroup" instead 232 * silently switch it to mount "cgroup" instead
233 */ 233 */
234static int cpuset_get_sb(struct file_system_type *fs_type, 234static struct dentry *cpuset_mount(struct file_system_type *fs_type,
235 int flags, const char *unused_dev_name, 235 int flags, const char *unused_dev_name, void *data)
236 void *data, struct vfsmount *mnt)
237{ 236{
238 struct file_system_type *cgroup_fs = get_fs_type("cgroup"); 237 struct file_system_type *cgroup_fs = get_fs_type("cgroup");
239 int ret = -ENODEV; 238 struct dentry *ret = ERR_PTR(-ENODEV);
240 if (cgroup_fs) { 239 if (cgroup_fs) {
241 char mountopts[] = 240 char mountopts[] =
242 "cpuset,noprefix," 241 "cpuset,noprefix,"
243 "release_agent=/sbin/cpuset_release_agent"; 242 "release_agent=/sbin/cpuset_release_agent";
244 ret = cgroup_fs->get_sb(cgroup_fs, flags, 243 ret = cgroup_fs->mount(cgroup_fs, flags,
245 unused_dev_name, mountopts, mnt); 244 unused_dev_name, mountopts);
246 put_filesystem(cgroup_fs); 245 put_filesystem(cgroup_fs);
247 } 246 }
248 return ret; 247 return ret;
@@ -250,7 +249,7 @@ static int cpuset_get_sb(struct file_system_type *fs_type,
250 249
251static struct file_system_type cpuset_fs_type = { 250static struct file_system_type cpuset_fs_type = {
252 .name = "cpuset", 251 .name = "cpuset",
253 .get_sb = cpuset_get_sb, 252 .mount = cpuset_mount,
254}; 253};
255 254
256/* 255/*
diff --git a/mm/shmem.c b/mm/shmem.c
index f6d350e8adc5..47fdeeb9d636 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2538,16 +2538,16 @@ static const struct vm_operations_struct shmem_vm_ops = {
2538}; 2538};
2539 2539
2540 2540
2541static int shmem_get_sb(struct file_system_type *fs_type, 2541static struct dentry *shmem_mount(struct file_system_type *fs_type,
2542 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 2542 int flags, const char *dev_name, void *data)
2543{ 2543{
2544 return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt); 2544 return mount_nodev(fs_type, flags, data, shmem_fill_super);
2545} 2545}
2546 2546
2547static struct file_system_type tmpfs_fs_type = { 2547static struct file_system_type tmpfs_fs_type = {
2548 .owner = THIS_MODULE, 2548 .owner = THIS_MODULE,
2549 .name = "tmpfs", 2549 .name = "tmpfs",
2550 .get_sb = shmem_get_sb, 2550 .mount = shmem_mount,
2551 .kill_sb = kill_litter_super, 2551 .kill_sb = kill_litter_super,
2552}; 2552};
2553 2553
@@ -2643,7 +2643,7 @@ out:
2643 2643
2644static struct file_system_type tmpfs_fs_type = { 2644static struct file_system_type tmpfs_fs_type = {
2645 .name = "tmpfs", 2645 .name = "tmpfs",
2646 .get_sb = ramfs_get_sb, 2646 .mount = ramfs_mount,
2647 .kill_sb = kill_litter_super, 2647 .kill_sb = kill_litter_super,
2648}; 2648};
2649 2649
diff --git a/net/socket.c b/net/socket.c
index ee3cd280c76e..5247ae10f374 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -305,19 +305,17 @@ static const struct super_operations sockfs_ops = {
305 .statfs = simple_statfs, 305 .statfs = simple_statfs,
306}; 306};
307 307
308static int sockfs_get_sb(struct file_system_type *fs_type, 308static struct dentry *sockfs_mount(struct file_system_type *fs_type,
309 int flags, const char *dev_name, void *data, 309 int flags, const char *dev_name, void *data)
310 struct vfsmount *mnt)
311{ 310{
312 return get_sb_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC, 311 return mount_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC);
313 mnt);
314} 312}
315 313
316static struct vfsmount *sock_mnt __read_mostly; 314static struct vfsmount *sock_mnt __read_mostly;
317 315
318static struct file_system_type sock_fs_type = { 316static struct file_system_type sock_fs_type = {
319 .name = "sockfs", 317 .name = "sockfs",
320 .get_sb = sockfs_get_sb, 318 .mount = sockfs_mount,
321 .kill_sb = kill_anon_super, 319 .kill_sb = kill_anon_super,
322}; 320};
323 321
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 7df92d237cb8..10a17a37ec4e 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -28,7 +28,7 @@
28#include <linux/sunrpc/rpc_pipe_fs.h> 28#include <linux/sunrpc/rpc_pipe_fs.h>
29#include <linux/sunrpc/cache.h> 29#include <linux/sunrpc/cache.h>
30 30
31static struct vfsmount *rpc_mount __read_mostly; 31static struct vfsmount *rpc_mnt __read_mostly;
32static int rpc_mount_count; 32static int rpc_mount_count;
33 33
34static struct file_system_type rpc_pipe_fs_type; 34static struct file_system_type rpc_pipe_fs_type;
@@ -417,16 +417,16 @@ struct vfsmount *rpc_get_mount(void)
417{ 417{
418 int err; 418 int err;
419 419
420 err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mount, &rpc_mount_count); 420 err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mnt, &rpc_mount_count);
421 if (err != 0) 421 if (err != 0)
422 return ERR_PTR(err); 422 return ERR_PTR(err);
423 return rpc_mount; 423 return rpc_mnt;
424} 424}
425EXPORT_SYMBOL_GPL(rpc_get_mount); 425EXPORT_SYMBOL_GPL(rpc_get_mount);
426 426
427void rpc_put_mount(void) 427void rpc_put_mount(void)
428{ 428{
429 simple_release_fs(&rpc_mount, &rpc_mount_count); 429 simple_release_fs(&rpc_mnt, &rpc_mount_count);
430} 430}
431EXPORT_SYMBOL_GPL(rpc_put_mount); 431EXPORT_SYMBOL_GPL(rpc_put_mount);
432 432
@@ -1018,17 +1018,17 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
1018 return 0; 1018 return 0;
1019} 1019}
1020 1020
1021static int 1021static struct dentry *
1022rpc_get_sb(struct file_system_type *fs_type, 1022rpc_mount(struct file_system_type *fs_type,
1023 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1023 int flags, const char *dev_name, void *data)
1024{ 1024{
1025 return get_sb_single(fs_type, flags, data, rpc_fill_super, mnt); 1025 return mount_single(fs_type, flags, data, rpc_fill_super);
1026} 1026}
1027 1027
1028static struct file_system_type rpc_pipe_fs_type = { 1028static struct file_system_type rpc_pipe_fs_type = {
1029 .owner = THIS_MODULE, 1029 .owner = THIS_MODULE,
1030 .name = "rpc_pipefs", 1030 .name = "rpc_pipefs",
1031 .get_sb = rpc_get_sb, 1031 .mount = rpc_mount,
1032 .kill_sb = kill_litter_super, 1032 .kill_sb = kill_litter_super,
1033}; 1033};
1034 1034
diff --git a/security/inode.c b/security/inode.c
index cb8f47c66a58..c4df2fbebe6b 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -131,17 +131,17 @@ static int fill_super(struct super_block *sb, void *data, int silent)
131 return simple_fill_super(sb, SECURITYFS_MAGIC, files); 131 return simple_fill_super(sb, SECURITYFS_MAGIC, files);
132} 132}
133 133
134static int get_sb(struct file_system_type *fs_type, 134static struct dentry *get_sb(struct file_system_type *fs_type,
135 int flags, const char *dev_name, 135 int flags, const char *dev_name,
136 void *data, struct vfsmount *mnt) 136 void *data)
137{ 137{
138 return get_sb_single(fs_type, flags, data, fill_super, mnt); 138 return mount_single(fs_type, flags, data, fill_super);
139} 139}
140 140
141static struct file_system_type fs_type = { 141static struct file_system_type fs_type = {
142 .owner = THIS_MODULE, 142 .owner = THIS_MODULE,
143 .name = "securityfs", 143 .name = "securityfs",
144 .get_sb = get_sb, 144 .mount = get_sb,
145 .kill_sb = kill_litter_super, 145 .kill_sb = kill_litter_super,
146}; 146};
147 147
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 55a755c1a1bd..073fd5b0a53a 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1909,16 +1909,15 @@ err:
1909 goto out; 1909 goto out;
1910} 1910}
1911 1911
1912static int sel_get_sb(struct file_system_type *fs_type, 1912static struct dentry *sel_mount(struct file_system_type *fs_type,
1913 int flags, const char *dev_name, void *data, 1913 int flags, const char *dev_name, void *data)
1914 struct vfsmount *mnt)
1915{ 1914{
1916 return get_sb_single(fs_type, flags, data, sel_fill_super, mnt); 1915 return mount_single(fs_type, flags, data, sel_fill_super);
1917} 1916}
1918 1917
1919static struct file_system_type sel_fs_type = { 1918static struct file_system_type sel_fs_type = {
1920 .name = "selinuxfs", 1919 .name = "selinuxfs",
1921 .get_sb = sel_get_sb, 1920 .mount = sel_mount,
1922 .kill_sb = kill_litter_super, 1921 .kill_sb = kill_litter_super,
1923}; 1922};
1924 1923
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 7512502d0162..dc1fd6239f24 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -1310,27 +1310,25 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent)
1310} 1310}
1311 1311
1312/** 1312/**
1313 * smk_get_sb - get the smackfs superblock 1313 * smk_mount - get the smackfs superblock
1314 * @fs_type: passed along without comment 1314 * @fs_type: passed along without comment
1315 * @flags: passed along without comment 1315 * @flags: passed along without comment
1316 * @dev_name: passed along without comment 1316 * @dev_name: passed along without comment
1317 * @data: passed along without comment 1317 * @data: passed along without comment
1318 * @mnt: passed along without comment
1319 * 1318 *
1320 * Just passes everything along. 1319 * Just passes everything along.
1321 * 1320 *
1322 * Returns what the lower level code does. 1321 * Returns what the lower level code does.
1323 */ 1322 */
1324static int smk_get_sb(struct file_system_type *fs_type, 1323static struct dentry *smk_mount(struct file_system_type *fs_type,
1325 int flags, const char *dev_name, void *data, 1324 int flags, const char *dev_name, void *data)
1326 struct vfsmount *mnt)
1327{ 1325{
1328 return get_sb_single(fs_type, flags, data, smk_fill_super, mnt); 1326 return mount_single(fs_type, flags, data, smk_fill_super);
1329} 1327}
1330 1328
1331static struct file_system_type smk_fs_type = { 1329static struct file_system_type smk_fs_type = {
1332 .name = "smackfs", 1330 .name = "smackfs",
1333 .get_sb = smk_get_sb, 1331 .mount = smk_mount,
1334 .kill_sb = kill_litter_super, 1332 .kill_sb = kill_litter_super,
1335}; 1333};
1336 1334