aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-06-23 05:02:57 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:42:45 -0400
commit454e2398be9b9fa30433fccc548db34d19aa9958 (patch)
tree1f61cb0c3716a33b661cfc8977e9beeb480a322c
parent1ad5544098a69d7dc1fa508cbb17e13a7a952fd8 (diff)
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that permits the VFS to pass in the target vfsmount that defines the mountpoint. The filesystem is then required to manually set the superblock and root dentry pointers. For most filesystems, this should be done with simple_set_mnt() which will set the superblock pointer and then set the root dentry to the superblock's s_root (as per the old default behaviour). The get_sb() op now returns an integer as there's now no need to return the superblock pointer. This patch permits a superblock to be implicitly shared amongst several mount points, such as can be done with NFS to avoid potential inode aliasing. In such a case, simple_set_mnt() would not be called, and instead the mnt_root and mnt_sb would be set directly. The patch also makes the following changes: (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount pointer argument and return an integer, so most filesystems have to change very little. (*) If one of the convenience function is not used, then get_sb() should normally call simple_set_mnt() to instantiate the vfsmount. This will always return 0, and so can be tail-called from get_sb(). (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the dcache upon superblock destruction rather than shrink_dcache_anon(). This is required because the superblock may now have multiple trees that aren't actually bound to s_root, but that still need to be cleaned up. The currently called functions assume that the whole tree is rooted at s_root, and that anonymous dentries are not the roots of trees which results in dentries being left unculled. However, with the way NFS superblock sharing are currently set to be implemented, these assumptions are violated: the root of the filesystem is simply a dummy dentry and inode (the real inode for '/' may well be inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries with child trees. [*] Anonymous until discovered from another tree. (*) The documentation has been adjusted, including the additional bit of changing ext2_* into foo_* in the documentation. [akpm@osdl.org: convert ipath_fs, do other stuff] Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Cc: Nathan Scott <nathans@sgi.com> Cc: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--Documentation/filesystems/Locking7
-rw-r--r--Documentation/filesystems/porting7
-rw-r--r--Documentation/filesystems/vfs.txt4
-rw-r--r--arch/ia64/kernel/perfmon.c7
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c6
-rw-r--r--drivers/infiniband/core/uverbs_main.c7
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c13
-rw-r--r--drivers/isdn/capi/capifs.c6
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c7
-rw-r--r--drivers/oprofile/oprofilefs.c6
-rw-r--r--drivers/usb/core/inode.c6
-rw-r--r--drivers/usb/gadget/inode.c6
-rw-r--r--fs/9p/vfs_super.c21
-rw-r--r--fs/adfs/super.c7
-rw-r--r--fs/affs/super.c7
-rw-r--r--fs/afs/super.c24
-rw-r--r--fs/autofs/init.c6
-rw-r--r--fs/autofs4/init.c6
-rw-r--r--fs/befs/linuxvfs.c7
-rw-r--r--fs/bfs/inode.c6
-rw-r--r--fs/binfmt_misc.c6
-rw-r--r--fs/block_dev.c6
-rw-r--r--fs/cifs/cifsfs.c10
-rw-r--r--fs/coda/inode.c6
-rw-r--r--fs/configfs/mount.c6
-rw-r--r--fs/cramfs/inode.c7
-rw-r--r--fs/dcache.c40
-rw-r--r--fs/debugfs/inode.c8
-rw-r--r--fs/devfs/base.c8
-rw-r--r--fs/devpts/inode.c6
-rw-r--r--fs/efs/super.c6
-rw-r--r--fs/eventpoll.c13
-rw-r--r--fs/ext2/super.c6
-rw-r--r--fs/ext3/super.c6
-rw-r--r--fs/freevxfs/vxfs_super.c7
-rw-r--r--fs/fuse/inode.c8
-rw-r--r--fs/hfs/super.c7
-rw-r--r--fs/hfsplus/super.c8
-rw-r--r--fs/hostfs/hostfs_kern.c8
-rw-r--r--fs/hpfs/super.c7
-rw-r--r--fs/hppfs/hppfs_kern.c8
-rw-r--r--fs/hugetlbfs/inode.c6
-rw-r--r--fs/inotify_user.c6
-rw-r--r--fs/isofs/inode.c7
-rw-r--r--fs/jffs/inode-v23.c7
-rw-r--r--fs/jffs2/super.c49
-rw-r--r--fs/jfs/super.c7
-rw-r--r--fs/libfs.c12
-rw-r--r--fs/minix/inode.c7
-rw-r--r--fs/msdos/namei.c9
-rw-r--r--fs/namespace.c9
-rw-r--r--fs/ncpfs/inode.c6
-rw-r--r--fs/nfs/inode.c96
-rw-r--r--fs/nfsd/nfsctl.c6
-rw-r--r--fs/ntfs/super.c7
-rw-r--r--fs/ocfs2/dlm/dlmfs.c6
-rw-r--r--fs/ocfs2/super.c12
-rw-r--r--fs/openpromfs/inode.c6
-rw-r--r--fs/pipe.c9
-rw-r--r--fs/proc/root.c6
-rw-r--r--fs/qnx4/inode.c7
-rw-r--r--fs/ramfs/inode.c13
-rw-r--r--fs/reiserfs/super.c9
-rw-r--r--fs/romfs/inode.c7
-rw-r--r--fs/smbfs/inode.c6
-rw-r--r--fs/super.c109
-rw-r--r--fs/sysfs/mount.c6
-rw-r--r--fs/sysv/super.c13
-rw-r--r--fs/udf/super.c6
-rw-r--r--fs/ufs/super.c6
-rw-r--r--fs/vfat/namei.c9
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c8
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/fs.h25
-rw-r--r--include/linux/ramfs.h4
-rw-r--r--ipc/mqueue.c8
-rw-r--r--kernel/cpuset.c8
-rw-r--r--kernel/futex.c8
-rw-r--r--mm/shmem.c6
-rw-r--r--net/socket.c7
-rw-r--r--net/sunrpc/rpc_pipe.c6
-rw-r--r--security/inode.c8
-rw-r--r--security/selinux/selinuxfs.c7
83 files changed, 482 insertions, 431 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 1045da582b9b..3abf08f1b14a 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -142,15 +142,16 @@ see also dquot_operations section.
142 142
143--------------------------- file_system_type --------------------------- 143--------------------------- file_system_type ---------------------------
144prototypes: 144prototypes:
145 struct super_block *(*get_sb) (struct file_system_type *, int, 145 struct int (*get_sb) (struct file_system_type *, int,
146 const char *, void *); 146 const char *, void *, struct vfsmount *);
147 void (*kill_sb) (struct super_block *); 147 void (*kill_sb) (struct super_block *);
148locking rules: 148locking rules:
149 may block BKL 149 may block BKL
150get_sb yes yes 150get_sb yes yes
151kill_sb yes yes 151kill_sb yes yes
152 152
153->get_sb() returns error or a locked superblock (exclusive on ->s_umount). 153->get_sb() returns error or 0 with locked superblock attached to the vfsmount
154(exclusive on ->s_umount).
154->kill_sb() takes a write-locked superblock, does all shutdown work on it, 155->kill_sb() takes a write-locked superblock, does all shutdown work on it,
155unlocks and drops the reference. 156unlocks and drops the reference.
156 157
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 2f388460cbe7..5531694059ab 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -50,10 +50,11 @@ Turn your foo_read_super() into a function that would return 0 in case of
50success and negative number in case of error (-EINVAL unless you have more 50success and negative number in case of error (-EINVAL unless you have more
51informative error value to report). Call it foo_fill_super(). Now declare 51informative error value to report). Call it foo_fill_super(). Now declare
52 52
53struct super_block foo_get_sb(struct file_system_type *fs_type, 53int foo_get_sb(struct file_system_type *fs_type,
54 int flags, const char *dev_name, void *data) 54 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
55{ 55{
56 return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super); 56 return get_sb_bdev(fs_type, flags, dev_name, data, foo_fill_super,
57 mnt);
57} 58}
58 59
59(or similar with s/bdev/nodev/ or s/bdev/single/, depending on the kind of 60(or similar with s/bdev/nodev/ or s/bdev/single/, depending on the kind of
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 3a2e5520c1e3..dd7d0dcedc87 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -113,8 +113,8 @@ members are defined:
113struct file_system_type { 113struct file_system_type {
114 const char *name; 114 const char *name;
115 int fs_flags; 115 int fs_flags;
116 struct super_block *(*get_sb) (struct file_system_type *, int, 116 struct int (*get_sb) (struct file_system_type *, int,
117 const char *, void *); 117 const char *, void *, struct vfsmount *);
118 void (*kill_sb) (struct super_block *); 118 void (*kill_sb) (struct super_block *);
119 struct module *owner; 119 struct module *owner;
120 struct file_system_type * next; 120 struct file_system_type * next;
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 077f21216b65..2359e2809f50 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -595,10 +595,11 @@ pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
595} 595}
596 596
597 597
598static struct super_block * 598static int
599pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) 599pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data,
600 struct vfsmount *mnt)
600{ 601{
601 return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC); 602 return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC, mnt);
602} 603}
603 604
604static struct file_system_type pfm_fs_type = { 605static struct file_system_type pfm_fs_type = {
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 1987697b23a0..7b4572805db9 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -436,11 +436,11 @@ spufs_fill_super(struct super_block *sb, void *data, int silent)
436 return spufs_create_root(sb, data); 436 return spufs_create_root(sb, data);
437} 437}
438 438
439static struct super_block * 439static int
440spufs_get_sb(struct file_system_type *fstype, int flags, 440spufs_get_sb(struct file_system_type *fstype, int flags,
441 const char *name, void *data) 441 const char *name, void *data, struct vfsmount *mnt)
442{ 442{
443 return get_sb_single(fstype, flags, data, spufs_fill_super); 443 return get_sb_single(fstype, flags, data, spufs_fill_super, mnt);
444} 444}
445 445
446static struct file_system_type spufs_type = { 446static struct file_system_type spufs_type = {
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 5ec2d49e9bb6..e57d3c50f75f 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -821,11 +821,12 @@ static void ib_uverbs_remove_one(struct ib_device *device)
821 kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); 821 kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
822} 822}
823 823
824static struct super_block *uverbs_event_get_sb(struct file_system_type *fs_type, int flags, 824static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags,
825 const char *dev_name, void *data) 825 const char *dev_name, void *data,
826 struct vfsmount *mnt)
826{ 827{
827 return get_sb_pseudo(fs_type, "infinibandevent:", NULL, 828 return get_sb_pseudo(fs_type, "infinibandevent:", NULL,
828 INFINIBANDEVENTFS_MAGIC); 829 INFINIBANDEVENTFS_MAGIC, mnt);
829} 830}
830 831
831static struct file_system_type uverbs_event_fs = { 832static struct file_system_type uverbs_event_fs = {
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index e274120567e1..63de3046aff3 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -542,13 +542,14 @@ bail:
542 return ret; 542 return ret;
543} 543}
544 544
545static struct super_block *ipathfs_get_sb(struct file_system_type *fs_type, 545static int ipathfs_get_sb(struct file_system_type *fs_type, int flags,
546 int flags, const char *dev_name, 546 const char *dev_name, void *data, struct vfsmount *mnt)
547 void *data)
548{ 547{
549 ipath_super = get_sb_single(fs_type, flags, data, 548 int ret = get_sb_single(fs_type, flags, data,
550 ipathfs_fill_super); 549 ipathfs_fill_super, mnt);
551 return ipath_super; 550 if (ret >= 0)
551 ipath_super = mnt->mnt_sb;
552 return ret;
552} 553}
553 554
554static void ipathfs_kill_super(struct super_block *s) 555static void ipathfs_kill_super(struct super_block *s)
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
index 0a37aded4b54..9ea6bd0ddc35 100644
--- a/drivers/isdn/capi/capifs.c
+++ b/drivers/isdn/capi/capifs.c
@@ -121,10 +121,10 @@ fail:
121 return -ENOMEM; 121 return -ENOMEM;
122} 122}
123 123
124static struct super_block *capifs_get_sb(struct file_system_type *fs_type, 124static int capifs_get_sb(struct file_system_type *fs_type,
125 int flags, const char *dev_name, void *data) 125 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
126{ 126{
127 return get_sb_single(fs_type, flags, data, capifs_fill_super); 127 return get_sb_single(fs_type, flags, data, capifs_fill_super, mnt);
128} 128}
129 129
130static struct file_system_type capifs_fs_type = { 130static struct file_system_type capifs_fs_type = {
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 26a230b6ff80..4a35caff5d02 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -90,10 +90,11 @@ static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root);
90static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent); 90static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent);
91 91
92 92
93static struct super_block *ibmasmfs_get_super(struct file_system_type *fst, 93static int ibmasmfs_get_super(struct file_system_type *fst,
94 int flags, const char *name, void *data) 94 int flags, const char *name, void *data,
95 struct vfsmount *mnt)
95{ 96{
96 return get_sb_single(fst, flags, data, ibmasmfs_fill_super); 97 return get_sb_single(fst, flags, data, ibmasmfs_fill_super, mnt);
97} 98}
98 99
99static struct super_operations ibmasmfs_s_ops = { 100static struct super_operations ibmasmfs_s_ops = {
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index b62da9b0cbf0..71c2da277d6e 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -272,10 +272,10 @@ static int oprofilefs_fill_super(struct super_block * sb, void * data, int silen
272} 272}
273 273
274 274
275static struct super_block *oprofilefs_get_sb(struct file_system_type *fs_type, 275static int oprofilefs_get_sb(struct file_system_type *fs_type,
276 int flags, const char *dev_name, void *data) 276 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
277{ 277{
278 return get_sb_single(fs_type, flags, data, oprofilefs_fill_super); 278 return get_sb_single(fs_type, flags, data, oprofilefs_fill_super, mnt);
279} 279}
280 280
281 281
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 3cf945cc5b9a..95f5ad923b0f 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -543,10 +543,10 @@ static void fs_remove_file (struct dentry *dentry)
543 543
544/* --------------------------------------------------------------------- */ 544/* --------------------------------------------------------------------- */
545 545
546static struct super_block *usb_get_sb(struct file_system_type *fs_type, 546static int usb_get_sb(struct file_system_type *fs_type,
547 int flags, const char *dev_name, void *data) 547 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
548{ 548{
549 return get_sb_single(fs_type, flags, data, usbfs_fill_super); 549 return get_sb_single(fs_type, flags, data, usbfs_fill_super, mnt);
550} 550}
551 551
552static struct file_system_type usb_fs_type = { 552static struct file_system_type usb_fs_type = {
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index aef0722b8f17..3bdc5e3ba234 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -2070,11 +2070,11 @@ enomem0:
2070} 2070}
2071 2071
2072/* "mount -t gadgetfs path /dev/gadget" ends up here */ 2072/* "mount -t gadgetfs path /dev/gadget" ends up here */
2073static struct super_block * 2073static int
2074gadgetfs_get_sb (struct file_system_type *t, int flags, 2074gadgetfs_get_sb (struct file_system_type *t, int flags,
2075 const char *path, void *opts) 2075 const char *path, void *opts, struct vfsmount *mnt)
2076{ 2076{
2077 return get_sb_single (t, flags, opts, gadgetfs_fill_super); 2077 return get_sb_single (t, flags, opts, gadgetfs_fill_super, mnt);
2078} 2078}
2079 2079
2080static void 2080static void
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 61c599b4a1e3..872943004e59 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -99,12 +99,13 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
99 * @flags: mount flags 99 * @flags: mount flags
100 * @dev_name: device name that was mounted 100 * @dev_name: device name that was mounted
101 * @data: mount options 101 * @data: mount options
102 * @mnt: mountpoint record to be instantiated
102 * 103 *
103 */ 104 */
104 105
105static struct super_block *v9fs_get_sb(struct file_system_type 106static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
106 *fs_type, int flags, 107 const char *dev_name, void *data,
107 const char *dev_name, void *data) 108 struct vfsmount *mnt)
108{ 109{
109 struct super_block *sb = NULL; 110 struct super_block *sb = NULL;
110 struct v9fs_fcall *fcall = NULL; 111 struct v9fs_fcall *fcall = NULL;
@@ -123,17 +124,19 @@ static struct super_block *v9fs_get_sb(struct file_system_type
123 124
124 v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); 125 v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
125 if (!v9ses) 126 if (!v9ses)
126 return ERR_PTR(-ENOMEM); 127 return -ENOMEM;
127 128
128 if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { 129 if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) {
129 dprintk(DEBUG_ERROR, "problem initiating session\n"); 130 dprintk(DEBUG_ERROR, "problem initiating session\n");
130 sb = ERR_PTR(newfid); 131 retval = newfid;
131 goto out_free_session; 132 goto out_free_session;
132 } 133 }
133 134
134 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 135 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
135 if (IS_ERR(sb)) 136 if (IS_ERR(sb)) {
137 retval = PTR_ERR(sb);
136 goto out_close_session; 138 goto out_close_session;
139 }
137 v9fs_fill_super(sb, v9ses, flags); 140 v9fs_fill_super(sb, v9ses, flags);
138 141
139 inode = v9fs_get_inode(sb, S_IFDIR | mode); 142 inode = v9fs_get_inode(sb, S_IFDIR | mode);
@@ -184,19 +187,19 @@ static struct super_block *v9fs_get_sb(struct file_system_type
184 goto put_back_sb; 187 goto put_back_sb;
185 } 188 }
186 189
187 return sb; 190 return simple_set_mnt(mnt, sb);
188 191
189out_close_session: 192out_close_session:
190 v9fs_session_close(v9ses); 193 v9fs_session_close(v9ses);
191out_free_session: 194out_free_session:
192 kfree(v9ses); 195 kfree(v9ses);
193 return sb; 196 return retval;
194 197
195put_back_sb: 198put_back_sb:
196 /* deactivate_super calls v9fs_kill_super which will frees the rest */ 199 /* deactivate_super calls v9fs_kill_super which will frees the rest */
197 up_write(&sb->s_umount); 200 up_write(&sb->s_umount);
198 deactivate_super(sb); 201 deactivate_super(sb);
199 return ERR_PTR(retval); 202 return retval;
200} 203}
201 204
202/** 205/**
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 252abda0d200..1b58a9b7f6aa 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -470,10 +470,11 @@ error:
470 return -EINVAL; 470 return -EINVAL;
471} 471}
472 472
473static struct super_block *adfs_get_sb(struct file_system_type *fs_type, 473static int adfs_get_sb(struct file_system_type *fs_type,
474 int flags, const char *dev_name, void *data) 474 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
475{ 475{
476 return get_sb_bdev(fs_type, flags, dev_name, data, adfs_fill_super); 476 return get_sb_bdev(fs_type, flags, dev_name, data, adfs_fill_super,
477 mnt);
477} 478}
478 479
479static struct file_system_type adfs_fs_type = { 480static struct file_system_type adfs_fs_type = {
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 4d7e5b19e5cd..6a52e7875403 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -524,10 +524,11 @@ affs_statfs(struct super_block *sb, struct kstatfs *buf)
524 return 0; 524 return 0;
525} 525}
526 526
527static struct super_block *affs_get_sb(struct file_system_type *fs_type, 527static int affs_get_sb(struct file_system_type *fs_type,
528 int flags, const char *dev_name, void *data) 528 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
529{ 529{
530 return get_sb_bdev(fs_type, flags, dev_name, data, affs_fill_super); 530 return get_sb_bdev(fs_type, flags, dev_name, data, affs_fill_super,
531 mnt);
531} 532}
532 533
533static struct file_system_type affs_fs_type = { 534static struct file_system_type affs_fs_type = {
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 53c56e7231ab..82468df0ba54 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -38,9 +38,9 @@ struct afs_mount_params {
38static void afs_i_init_once(void *foo, kmem_cache_t *cachep, 38static void afs_i_init_once(void *foo, kmem_cache_t *cachep,
39 unsigned long flags); 39 unsigned long flags);
40 40
41static struct super_block *afs_get_sb(struct file_system_type *fs_type, 41static int afs_get_sb(struct file_system_type *fs_type,
42 int flags, const char *dev_name, 42 int flags, const char *dev_name,
43 void *data); 43 void *data, struct vfsmount *mnt);
44 44
45static struct inode *afs_alloc_inode(struct super_block *sb); 45static struct inode *afs_alloc_inode(struct super_block *sb);
46 46
@@ -294,10 +294,11 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent)
294 * get an AFS superblock 294 * get an AFS superblock
295 * - TODO: don't use get_sb_nodev(), but rather call sget() directly 295 * - TODO: don't use get_sb_nodev(), but rather call sget() directly
296 */ 296 */
297static struct super_block *afs_get_sb(struct file_system_type *fs_type, 297static int afs_get_sb(struct file_system_type *fs_type,
298 int flags, 298 int flags,
299 const char *dev_name, 299 const char *dev_name,
300 void *options) 300 void *options,
301 struct vfsmount *mnt)
301{ 302{
302 struct afs_mount_params params; 303 struct afs_mount_params params;
303 struct super_block *sb; 304 struct super_block *sb;
@@ -311,7 +312,7 @@ static struct super_block *afs_get_sb(struct file_system_type *fs_type,
311 ret = afscm_start(); 312 ret = afscm_start();
312 if (ret < 0) { 313 if (ret < 0) {
313 _leave(" = %d", ret); 314 _leave(" = %d", ret);
314 return ERR_PTR(ret); 315 return ret;
315 } 316 }
316 317
317 /* parse the options */ 318 /* parse the options */
@@ -348,18 +349,19 @@ static struct super_block *afs_get_sb(struct file_system_type *fs_type,
348 goto error; 349 goto error;
349 } 350 }
350 sb->s_flags |= MS_ACTIVE; 351 sb->s_flags |= MS_ACTIVE;
352 simple_set_mnt(mnt, sb);
351 353
352 afs_put_volume(params.volume); 354 afs_put_volume(params.volume);
353 afs_put_cell(params.default_cell); 355 afs_put_cell(params.default_cell);
354 _leave(" = %p", sb); 356 _leave(" = 0 [%p]", 0, sb);
355 return sb; 357 return 0;
356 358
357 error: 359 error:
358 afs_put_volume(params.volume); 360 afs_put_volume(params.volume);
359 afs_put_cell(params.default_cell); 361 afs_put_cell(params.default_cell);
360 afscm_stop(); 362 afscm_stop();
361 _leave(" = %d", ret); 363 _leave(" = %d", ret);
362 return ERR_PTR(ret); 364 return ret;
363} /* end afs_get_sb() */ 365} /* end afs_get_sb() */
364 366
365/*****************************************************************************/ 367/*****************************************************************************/
diff --git a/fs/autofs/init.c b/fs/autofs/init.c
index b977ece69f0c..aca123752406 100644
--- a/fs/autofs/init.c
+++ b/fs/autofs/init.c
@@ -14,10 +14,10 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include "autofs_i.h" 15#include "autofs_i.h"
16 16
17static struct super_block *autofs_get_sb(struct file_system_type *fs_type, 17static int autofs_get_sb(struct file_system_type *fs_type,
18 int flags, const char *dev_name, void *data) 18 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
19{ 19{
20 return get_sb_nodev(fs_type, flags, data, autofs_fill_super); 20 return get_sb_nodev(fs_type, flags, data, autofs_fill_super, mnt);
21} 21}
22 22
23static struct file_system_type autofs_fs_type = { 23static struct file_system_type autofs_fs_type = {
diff --git a/fs/autofs4/init.c b/fs/autofs4/init.c
index acecec8578ce..5d9193332bef 100644
--- a/fs/autofs4/init.c
+++ b/fs/autofs4/init.c
@@ -14,10 +14,10 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include "autofs_i.h" 15#include "autofs_i.h"
16 16
17static struct super_block *autofs_get_sb(struct file_system_type *fs_type, 17static int autofs_get_sb(struct file_system_type *fs_type,
18 int flags, const char *dev_name, void *data) 18 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
19{ 19{
20 return get_sb_nodev(fs_type, flags, data, autofs4_fill_super); 20 return get_sb_nodev(fs_type, flags, data, autofs4_fill_super, mnt);
21} 21}
22 22
23static struct file_system_type autofs_fs_type = { 23static struct file_system_type autofs_fs_type = {
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 68ebd10f345d..6ed07a5f10c6 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -899,11 +899,12 @@ befs_statfs(struct super_block *sb, struct kstatfs *buf)
899 return 0; 899 return 0;
900} 900}
901 901
902static struct super_block * 902static int
903befs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, 903befs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name,
904 void *data) 904 void *data, struct vfsmount *mnt)
905{ 905{
906 return get_sb_bdev(fs_type, flags, dev_name, data, befs_fill_super); 906 return get_sb_bdev(fs_type, flags, dev_name, data, befs_fill_super,
907 mnt);
907} 908}
908 909
909static struct file_system_type befs_fs_type = { 910static struct file_system_type befs_fs_type = {
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 55a7a78332f8..e7da03f63a5a 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -410,10 +410,10 @@ out:
410 return -EINVAL; 410 return -EINVAL;
411} 411}
412 412
413static struct super_block *bfs_get_sb(struct file_system_type *fs_type, 413static int bfs_get_sb(struct file_system_type *fs_type,
414 int flags, const char *dev_name, void *data) 414 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
415{ 415{
416 return get_sb_bdev(fs_type, flags, dev_name, data, bfs_fill_super); 416 return get_sb_bdev(fs_type, flags, dev_name, data, bfs_fill_super, mnt);
417} 417}
418 418
419static struct file_system_type bfs_fs_type = { 419static struct file_system_type bfs_fs_type = {
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 599f36fd0f67..07a4996cca3f 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -739,10 +739,10 @@ static int bm_fill_super(struct super_block * sb, void * data, int silent)
739 return err; 739 return err;
740} 740}
741 741
742static struct super_block *bm_get_sb(struct file_system_type *fs_type, 742static int bm_get_sb(struct file_system_type *fs_type,
743 int flags, const char *dev_name, void *data) 743 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
744{ 744{
745 return get_sb_single(fs_type, flags, data, bm_fill_super); 745 return get_sb_single(fs_type, flags, data, bm_fill_super, mnt);
746} 746}
747 747
748static struct linux_binfmt misc_format = { 748static struct linux_binfmt misc_format = {
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 44aaba202f78..028d9fb9c2d5 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -300,10 +300,10 @@ static struct super_operations bdev_sops = {
300 .clear_inode = bdev_clear_inode, 300 .clear_inode = bdev_clear_inode,
301}; 301};
302 302
303static struct super_block *bd_get_sb(struct file_system_type *fs_type, 303static int bd_get_sb(struct file_system_type *fs_type,
304 int flags, const char *dev_name, void *data) 304 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
305{ 305{
306 return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576); 306 return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576, mnt);
307} 307}
308 308
309static struct file_system_type bd_type = { 309static struct file_system_type bd_type = {
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index c262d8874ce9..08b35801dfed 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -460,9 +460,9 @@ struct super_operations cifs_super_ops = {
460 .remount_fs = cifs_remount, 460 .remount_fs = cifs_remount,
461}; 461};
462 462
463static struct super_block * 463static int
464cifs_get_sb(struct file_system_type *fs_type, 464cifs_get_sb(struct file_system_type *fs_type,
465 int flags, const char *dev_name, void *data) 465 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
466{ 466{
467 int rc; 467 int rc;
468 struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL); 468 struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL);
@@ -470,7 +470,7 @@ cifs_get_sb(struct file_system_type *fs_type,
470 cFYI(1, ("Devname: %s flags: %d ", dev_name, flags)); 470 cFYI(1, ("Devname: %s flags: %d ", dev_name, flags));
471 471
472 if (IS_ERR(sb)) 472 if (IS_ERR(sb))
473 return sb; 473 return PTR_ERR(sb);
474 474
475 sb->s_flags = flags; 475 sb->s_flags = flags;
476 476
@@ -478,10 +478,10 @@ cifs_get_sb(struct file_system_type *fs_type,
478 if (rc) { 478 if (rc) {
479 up_write(&sb->s_umount); 479 up_write(&sb->s_umount);
480 deactivate_super(sb); 480 deactivate_super(sb);
481 return ERR_PTR(rc); 481 return rc;
482 } 482 }
483 sb->s_flags |= MS_ACTIVE; 483 sb->s_flags |= MS_ACTIVE;
484 return sb; 484 return simple_set_mnt(mnt, sb);
485} 485}
486 486
487static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov, 487static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov,
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index ada1a81df6bd..cba70201567d 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -307,10 +307,10 @@ static int coda_statfs(struct super_block *sb, struct kstatfs *buf)
307 307
308/* init_coda: used by filesystems.c to register coda */ 308/* init_coda: used by filesystems.c to register coda */
309 309
310static struct super_block *coda_get_sb(struct file_system_type *fs_type, 310static int coda_get_sb(struct file_system_type *fs_type,
311 int flags, const char *dev_name, void *data) 311 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
312{ 312{
313 return get_sb_nodev(fs_type, flags, data, coda_fill_super); 313 return get_sb_nodev(fs_type, flags, data, coda_fill_super, mnt);
314} 314}
315 315
316struct file_system_type coda_fs_type = { 316struct file_system_type coda_fs_type = {
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index f920d30478e5..94dab7bdd851 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -103,10 +103,10 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
103 return 0; 103 return 0;
104} 104}
105 105
106static struct super_block *configfs_get_sb(struct file_system_type *fs_type, 106static int configfs_get_sb(struct file_system_type *fs_type,
107 int flags, const char *dev_name, void *data) 107 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
108{ 108{
109 return get_sb_single(fs_type, flags, data, configfs_fill_super); 109 return get_sb_single(fs_type, flags, data, configfs_fill_super, mnt);
110} 110}
111 111
112static struct file_system_type configfs_fs_type = { 112static struct file_system_type configfs_fs_type = {
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 9efcc3a164e8..37a91a153aa5 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -528,10 +528,11 @@ static struct super_operations cramfs_ops = {
528 .statfs = cramfs_statfs, 528 .statfs = cramfs_statfs,
529}; 529};
530 530
531static struct super_block *cramfs_get_sb(struct file_system_type *fs_type, 531static int cramfs_get_sb(struct file_system_type *fs_type,
532 int flags, const char *dev_name, void *data) 532 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
533{ 533{
534 return get_sb_bdev(fs_type, flags, dev_name, data, cramfs_fill_super); 534 return get_sb_bdev(fs_type, flags, dev_name, data, cramfs_fill_super,
535 mnt);
535} 536}
536 537
537static struct file_system_type cramfs_fs_type = { 538static struct file_system_type cramfs_fs_type = {
diff --git a/fs/dcache.c b/fs/dcache.c
index 59dbc92c2079..313b54b2b8f2 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -687,46 +687,6 @@ void shrink_dcache_parent(struct dentry * parent)
687 prune_dcache(found, parent->d_sb); 687 prune_dcache(found, parent->d_sb);
688} 688}
689 689
690/**
691 * shrink_dcache_anon - further prune the cache
692 * @head: head of d_hash list of dentries to prune
693 *
694 * Prune the dentries that are anonymous
695 *
696 * parsing d_hash list does not hlist_for_each_entry_rcu() as it
697 * done under dcache_lock.
698 *
699 */
700void shrink_dcache_anon(struct super_block *sb)
701{
702 struct hlist_node *lp;
703 struct hlist_head *head = &sb->s_anon;
704 int found;
705 do {
706 found = 0;
707 spin_lock(&dcache_lock);
708 hlist_for_each(lp, head) {
709 struct dentry *this = hlist_entry(lp, struct dentry, d_hash);
710 if (!list_empty(&this->d_lru)) {
711 dentry_stat.nr_unused--;
712 list_del_init(&this->d_lru);
713 }
714
715 /*
716 * move only zero ref count dentries to the end
717 * of the unused list for prune_dcache
718 */
719 if (!atomic_read(&this->d_count)) {
720 list_add_tail(&this->d_lru, &dentry_unused);
721 dentry_stat.nr_unused++;
722 found++;
723 }
724 }
725 spin_unlock(&dcache_lock);
726 prune_dcache(found, sb);
727 } while(found);
728}
729
730/* 690/*
731 * Scan `nr' dentries and return the number which remain. 691 * Scan `nr' dentries and return the number which remain.
732 * 692 *
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b55b4ea9a676..440128ebef3b 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -111,11 +111,11 @@ static int debug_fill_super(struct super_block *sb, void *data, int silent)
111 return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); 111 return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files);
112} 112}
113 113
114static struct super_block *debug_get_sb(struct file_system_type *fs_type, 114static int debug_get_sb(struct file_system_type *fs_type,
115 int flags, const char *dev_name, 115 int flags, const char *dev_name,
116 void *data) 116 void *data, struct vfsmount *mnt)
117{ 117{
118 return get_sb_single(fs_type, flags, data, debug_fill_super); 118 return get_sb_single(fs_type, flags, data, debug_fill_super, mnt);
119} 119}
120 120
121static struct file_system_type debug_fs_type = { 121static struct file_system_type debug_fs_type = {
diff --git a/fs/devfs/base.c b/fs/devfs/base.c
index 52f5059c4f31..51a97f132745 100644
--- a/fs/devfs/base.c
+++ b/fs/devfs/base.c
@@ -2549,11 +2549,11 @@ static int devfs_fill_super(struct super_block *sb, void *data, int silent)
2549 return -EINVAL; 2549 return -EINVAL;
2550} /* End Function devfs_fill_super */ 2550} /* End Function devfs_fill_super */
2551 2551
2552static struct super_block *devfs_get_sb(struct file_system_type *fs_type, 2552static int devfs_get_sb(struct file_system_type *fs_type,
2553 int flags, const char *dev_name, 2553 int flags, const char *dev_name,
2554 void *data) 2554 void *data, struct vfsmount *mnt)
2555{ 2555{
2556 return get_sb_single(fs_type, flags, data, devfs_fill_super); 2556 return get_sb_single(fs_type, flags, data, devfs_fill_super, mnt);
2557} 2557}
2558 2558
2559static struct file_system_type devfs_fs_type = { 2559static struct file_system_type devfs_fs_type = {
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 14c5620b5cab..f7aef5bb584a 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -130,10 +130,10 @@ fail:
130 return -ENOMEM; 130 return -ENOMEM;
131} 131}
132 132
133static struct super_block *devpts_get_sb(struct file_system_type *fs_type, 133static int devpts_get_sb(struct file_system_type *fs_type,
134 int flags, const char *dev_name, void *data) 134 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
135{ 135{
136 return get_sb_single(fs_type, flags, data, devpts_fill_super); 136 return get_sb_single(fs_type, flags, data, devpts_fill_super, mnt);
137} 137}
138 138
139static struct file_system_type devpts_fs_type = { 139static struct file_system_type devpts_fs_type = {
diff --git a/fs/efs/super.c b/fs/efs/super.c
index dff623e3ddbf..1ba5e14f879f 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -18,10 +18,10 @@
18static int efs_statfs(struct super_block *s, struct kstatfs *buf); 18static int efs_statfs(struct super_block *s, struct kstatfs *buf);
19static int efs_fill_super(struct super_block *s, void *d, int silent); 19static int efs_fill_super(struct super_block *s, void *d, int silent);
20 20
21static struct super_block *efs_get_sb(struct file_system_type *fs_type, 21static int efs_get_sb(struct file_system_type *fs_type,
22 int flags, const char *dev_name, void *data) 22 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
23{ 23{
24 return get_sb_bdev(fs_type, flags, dev_name, data, efs_fill_super); 24 return get_sb_bdev(fs_type, flags, dev_name, data, efs_fill_super, mnt);
25} 25}
26 26
27static struct file_system_type efs_fs_type = { 27static struct file_system_type efs_fs_type = {
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 2695337d4d64..08e7e6a555ca 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -268,9 +268,9 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
268 int maxevents, long timeout); 268 int maxevents, long timeout);
269static int eventpollfs_delete_dentry(struct dentry *dentry); 269static int eventpollfs_delete_dentry(struct dentry *dentry);
270static struct inode *ep_eventpoll_inode(void); 270static struct inode *ep_eventpoll_inode(void);
271static struct super_block *eventpollfs_get_sb(struct file_system_type *fs_type, 271static int eventpollfs_get_sb(struct file_system_type *fs_type,
272 int flags, const char *dev_name, 272 int flags, const char *dev_name,
273 void *data); 273 void *data, struct vfsmount *mnt);
274 274
275/* 275/*
276 * This semaphore is used to serialize ep_free() and eventpoll_release_file(). 276 * This semaphore is used to serialize ep_free() and eventpoll_release_file().
@@ -1595,11 +1595,12 @@ eexit_1:
1595} 1595}
1596 1596
1597 1597
1598static struct super_block * 1598static int
1599eventpollfs_get_sb(struct file_system_type *fs_type, int flags, 1599eventpollfs_get_sb(struct file_system_type *fs_type, int flags,
1600 const char *dev_name, void *data) 1600 const char *dev_name, void *data, struct vfsmount *mnt)
1601{ 1601{
1602 return get_sb_pseudo(fs_type, "eventpoll:", NULL, EVENTPOLLFS_MAGIC); 1602 return get_sb_pseudo(fs_type, "eventpoll:", NULL, EVENTPOLLFS_MAGIC,
1603 mnt);
1603} 1604}
1604 1605
1605 1606
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 7e30bae174ed..a4dfffac5967 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1087,10 +1087,10 @@ static int ext2_statfs (struct super_block * sb, struct kstatfs * buf)
1087 return 0; 1087 return 0;
1088} 1088}
1089 1089
1090static struct super_block *ext2_get_sb(struct file_system_type *fs_type, 1090static int ext2_get_sb(struct file_system_type *fs_type,
1091 int flags, const char *dev_name, void *data) 1091 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
1092{ 1092{
1093 return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super); 1093 return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super, mnt);
1094} 1094}
1095 1095
1096#ifdef CONFIG_QUOTA 1096#ifdef CONFIG_QUOTA
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index f8a5266ea1ff..657f8e73b62f 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2646,10 +2646,10 @@ out:
2646 2646
2647#endif 2647#endif
2648 2648
2649static struct super_block *ext3_get_sb(struct file_system_type *fs_type, 2649static int ext3_get_sb(struct file_system_type *fs_type,
2650 int flags, const char *dev_name, void *data) 2650 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
2651{ 2651{
2652 return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super); 2652 return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super, mnt);
2653} 2653}
2654 2654
2655static struct file_system_type ext3_fs_type = { 2655static struct file_system_type ext3_fs_type = {
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index b44c916d24a1..d76eeaafbde2 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -241,10 +241,11 @@ out:
241/* 241/*
242 * The usual module blurb. 242 * The usual module blurb.
243 */ 243 */
244static struct super_block *vxfs_get_sb(struct file_system_type *fs_type, 244static int vxfs_get_sb(struct file_system_type *fs_type,
245 int flags, const char *dev_name, void *data) 245 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
246{ 246{
247 return get_sb_bdev(fs_type, flags, dev_name, data, vxfs_fill_super); 247 return get_sb_bdev(fs_type, flags, dev_name, data, vxfs_fill_super,
248 mnt);
248} 249}
249 250
250static struct file_system_type vxfs_fs_type = { 251static struct file_system_type vxfs_fs_type = {
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 7627022446b2..c91f0a50aadb 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -569,11 +569,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
569 return err; 569 return err;
570} 570}
571 571
572static struct super_block *fuse_get_sb(struct file_system_type *fs_type, 572static int fuse_get_sb(struct file_system_type *fs_type,
573 int flags, const char *dev_name, 573 int flags, const char *dev_name,
574 void *raw_data) 574 void *raw_data, struct vfsmount *mnt)
575{ 575{
576 return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super); 576 return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt);
577} 577}
578 578
579static struct file_system_type fuse_fs_type = { 579static struct file_system_type fuse_fs_type = {
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 1181d116117d..ee5b80a409e8 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -413,10 +413,11 @@ bail:
413 return res; 413 return res;
414} 414}
415 415
416static struct super_block *hfs_get_sb(struct file_system_type *fs_type, 416static int hfs_get_sb(struct file_system_type *fs_type,
417 int flags, const char *dev_name, void *data) 417 int flags, const char *dev_name, void *data,
418 struct vfsmount *mnt)
418{ 419{
419 return get_sb_bdev(fs_type, flags, dev_name, data, hfs_fill_super); 420 return get_sb_bdev(fs_type, flags, dev_name, data, hfs_fill_super, mnt);
420} 421}
421 422
422static struct file_system_type hfs_fs_type = { 423static struct file_system_type hfs_fs_type = {
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 7843f792a4b7..0ed8b7e8e87f 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -450,10 +450,12 @@ static void hfsplus_destroy_inode(struct inode *inode)
450 450
451#define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info) 451#define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info)
452 452
453static struct super_block *hfsplus_get_sb(struct file_system_type *fs_type, 453static int hfsplus_get_sb(struct file_system_type *fs_type,
454 int flags, const char *dev_name, void *data) 454 int flags, const char *dev_name, void *data,
455 struct vfsmount *mnt)
455{ 456{
456 return get_sb_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super); 457 return get_sb_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super,
458 mnt);
457} 459}
458 460
459static struct file_system_type hfsplus_fs_type = { 461static struct file_system_type hfsplus_fs_type = {
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index bf0f8e16e433..04035e08f5c1 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -993,11 +993,11 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
993 return(err); 993 return(err);
994} 994}
995 995
996static struct super_block *hostfs_read_sb(struct file_system_type *type, 996static int hostfs_read_sb(struct file_system_type *type,
997 int flags, const char *dev_name, 997 int flags, const char *dev_name,
998 void *data) 998 void *data, struct vfsmount *mnt)
999{ 999{
1000 return(get_sb_nodev(type, flags, data, hostfs_fill_sb_common)); 1000 return get_sb_nodev(type, flags, data, hostfs_fill_sb_common, mnt);
1001} 1001}
1002 1002
1003static struct file_system_type hostfs_type = { 1003static struct file_system_type hostfs_type = {
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index d72d8c87c996..3b25cf3e2e65 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -662,10 +662,11 @@ bail0:
662 return -EINVAL; 662 return -EINVAL;
663} 663}
664 664
665static struct super_block *hpfs_get_sb(struct file_system_type *fs_type, 665static int hpfs_get_sb(struct file_system_type *fs_type,
666 int flags, const char *dev_name, void *data) 666 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
667{ 667{
668 return get_sb_bdev(fs_type, flags, dev_name, data, hpfs_fill_super); 668 return get_sb_bdev(fs_type, flags, dev_name, data, hpfs_fill_super,
669 mnt);
669} 670}
670 671
671static struct file_system_type hpfs_fs_type = { 672static struct file_system_type hpfs_fs_type = {
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c
index 5e6363be246f..ec43c22bc9c0 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs_kern.c
@@ -769,11 +769,11 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
769 return(err); 769 return(err);
770} 770}
771 771
772static struct super_block *hppfs_read_super(struct file_system_type *type, 772static int hppfs_read_super(struct file_system_type *type,
773 int flags, const char *dev_name, 773 int flags, const char *dev_name,
774 void *data) 774 void *data, struct vfsmount *mnt)
775{ 775{
776 return(get_sb_nodev(type, flags, data, hppfs_fill_super)); 776 return get_sb_nodev(type, flags, data, hppfs_fill_super, mnt);
777} 777}
778 778
779static struct file_system_type hppfs_type = { 779static struct file_system_type hppfs_type = {
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 3a5b4e923455..4665c26171f7 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -723,10 +723,10 @@ void hugetlb_put_quota(struct address_space *mapping)
723 } 723 }
724} 724}
725 725
726static struct super_block *hugetlbfs_get_sb(struct file_system_type *fs_type, 726static int hugetlbfs_get_sb(struct file_system_type *fs_type,
727 int flags, const char *dev_name, void *data) 727 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
728{ 728{
729 return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super); 729 return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super, mnt);
730} 730}
731 731
732static struct file_system_type hugetlbfs_fs_type = { 732static struct file_system_type hugetlbfs_fs_type = {
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 9e9931e2badd..f2386442adee 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -672,11 +672,11 @@ out:
672 return ret; 672 return ret;
673} 673}
674 674
675static struct super_block * 675static int
676inotify_get_sb(struct file_system_type *fs_type, int flags, 676inotify_get_sb(struct file_system_type *fs_type, int flags,
677 const char *dev_name, void *data) 677 const char *dev_name, void *data, struct vfsmount *mnt)
678{ 678{
679 return get_sb_pseudo(fs_type, "inotify", NULL, 0xBAD1DEA); 679 return get_sb_pseudo(fs_type, "inotify", NULL, 0xBAD1DEA, mnt);
680} 680}
681 681
682static struct file_system_type inotify_fs_type = { 682static struct file_system_type inotify_fs_type = {
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 70adbb98bad1..17268da63a49 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1399,10 +1399,11 @@ struct inode *isofs_iget(struct super_block *sb,
1399 return inode; 1399 return inode;
1400} 1400}
1401 1401
1402static struct super_block *isofs_get_sb(struct file_system_type *fs_type, 1402static int isofs_get_sb(struct file_system_type *fs_type,
1403 int flags, const char *dev_name, void *data) 1403 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
1404{ 1404{
1405 return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super); 1405 return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super,
1406 mnt);
1406} 1407}
1407 1408
1408static struct file_system_type iso9660_fs_type = { 1409static struct file_system_type iso9660_fs_type = {
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index 020cc097c539..dd93a091ad67 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -1785,10 +1785,11 @@ static struct super_operations jffs_ops =
1785 .remount_fs = jffs_remount, 1785 .remount_fs = jffs_remount,
1786}; 1786};
1787 1787
1788static struct super_block *jffs_get_sb(struct file_system_type *fs_type, 1788static int jffs_get_sb(struct file_system_type *fs_type,
1789 int flags, const char *dev_name, void *data) 1789 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
1790{ 1790{
1791 return get_sb_bdev(fs_type, flags, dev_name, data, jffs_fill_super); 1791 return get_sb_bdev(fs_type, flags, dev_name, data, jffs_fill_super,
1792 mnt);
1792} 1793}
1793 1794
1794static struct file_system_type jffs_fs_type = { 1795static struct file_system_type jffs_fs_type = {
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 9d0521451f59..2378a662c256 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -111,9 +111,10 @@ static int jffs2_sb_set(struct super_block *sb, void *data)
111 return 0; 111 return 0;
112} 112}
113 113
114static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type, 114static int jffs2_get_sb_mtd(struct file_system_type *fs_type,
115 int flags, const char *dev_name, 115 int flags, const char *dev_name,
116 void *data, struct mtd_info *mtd) 116 void *data, struct mtd_info *mtd,
117 struct vfsmount *mnt)
117{ 118{
118 struct super_block *sb; 119 struct super_block *sb;
119 struct jffs2_sb_info *c; 120 struct jffs2_sb_info *c;
@@ -121,19 +122,20 @@ static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type,
121 122
122 c = kmalloc(sizeof(*c), GFP_KERNEL); 123 c = kmalloc(sizeof(*c), GFP_KERNEL);
123 if (!c) 124 if (!c)
124 return ERR_PTR(-ENOMEM); 125 return -ENOMEM;
125 memset(c, 0, sizeof(*c)); 126 memset(c, 0, sizeof(*c));
126 c->mtd = mtd; 127 c->mtd = mtd;
127 128
128 sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c); 129 sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c);
129 130
130 if (IS_ERR(sb)) 131 if (IS_ERR(sb))
131 goto out_put; 132 goto out_error;
132 133
133 if (sb->s_root) { 134 if (sb->s_root) {
134 /* New mountpoint for JFFS2 which is already mounted */ 135 /* New mountpoint for JFFS2 which is already mounted */
135 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): Device %d (\"%s\") is already mounted\n", 136 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): Device %d (\"%s\") is already mounted\n",
136 mtd->index, mtd->name)); 137 mtd->index, mtd->name));
138 ret = simple_set_mnt(mnt, sb);
137 goto out_put; 139 goto out_put;
138 } 140 }
139 141
@@ -161,44 +163,47 @@ static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type,
161 /* Failure case... */ 163 /* Failure case... */
162 up_write(&sb->s_umount); 164 up_write(&sb->s_umount);
163 deactivate_super(sb); 165 deactivate_super(sb);
164 return ERR_PTR(ret); 166 return ret;
165 } 167 }
166 168
167 sb->s_flags |= MS_ACTIVE; 169 sb->s_flags |= MS_ACTIVE;
168 return sb; 170 return simple_set_mnt(mnt, sb);
169 171
172out_error:
173 ret = PTR_ERR(sb);
170 out_put: 174 out_put:
171 kfree(c); 175 kfree(c);
172 put_mtd_device(mtd); 176 put_mtd_device(mtd);
173 177
174 return sb; 178 return ret;
175} 179}
176 180
177static struct super_block *jffs2_get_sb_mtdnr(struct file_system_type *fs_type, 181static int jffs2_get_sb_mtdnr(struct file_system_type *fs_type,
178 int flags, const char *dev_name, 182 int flags, const char *dev_name,
179 void *data, int mtdnr) 183 void *data, int mtdnr,
184 struct vfsmount *mnt)
180{ 185{
181 struct mtd_info *mtd; 186 struct mtd_info *mtd;
182 187
183 mtd = get_mtd_device(NULL, mtdnr); 188 mtd = get_mtd_device(NULL, mtdnr);
184 if (!mtd) { 189 if (!mtd) {
185 D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr)); 190 D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr));
186 return ERR_PTR(-EINVAL); 191 return -EINVAL;
187 } 192 }
188 193
189 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd); 194 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt);
190} 195}
191 196
192static struct super_block *jffs2_get_sb(struct file_system_type *fs_type, 197static int jffs2_get_sb(struct file_system_type *fs_type,
193 int flags, const char *dev_name, 198 int flags, const char *dev_name,
194 void *data) 199 void *data, struct vfsmount *mnt)
195{ 200{
196 int err; 201 int err;
197 struct nameidata nd; 202 struct nameidata nd;
198 int mtdnr; 203 int mtdnr;
199 204
200 if (!dev_name) 205 if (!dev_name)
201 return ERR_PTR(-EINVAL); 206 return -EINVAL;
202 207
203 D1(printk(KERN_DEBUG "jffs2_get_sb(): dev_name \"%s\"\n", dev_name)); 208 D1(printk(KERN_DEBUG "jffs2_get_sb(): dev_name \"%s\"\n", dev_name));
204 209
@@ -220,7 +225,7 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
220 mtd = get_mtd_device(NULL, mtdnr); 225 mtd = get_mtd_device(NULL, mtdnr);
221 if (mtd) { 226 if (mtd) {
222 if (!strcmp(mtd->name, dev_name+4)) 227 if (!strcmp(mtd->name, dev_name+4))
223 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd); 228 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt);
224 put_mtd_device(mtd); 229 put_mtd_device(mtd);
225 } 230 }
226 } 231 }
@@ -233,7 +238,7 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
233 if (!*endptr) { 238 if (!*endptr) {
234 /* It was a valid number */ 239 /* It was a valid number */
235 D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd%%d, mtdnr %d\n", mtdnr)); 240 D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd%%d, mtdnr %d\n", mtdnr));
236 return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr); 241 return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr, mnt);
237 } 242 }
238 } 243 }
239 } 244 }
@@ -247,7 +252,7 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
247 err, nd.dentry->d_inode)); 252 err, nd.dentry->d_inode));
248 253
249 if (err) 254 if (err)
250 return ERR_PTR(err); 255 return err;
251 256
252 err = -EINVAL; 257 err = -EINVAL;
253 258
@@ -269,11 +274,11 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
269 mtdnr = iminor(nd.dentry->d_inode); 274 mtdnr = iminor(nd.dentry->d_inode);
270 path_release(&nd); 275 path_release(&nd);
271 276
272 return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr); 277 return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr, mnt);
273 278
274out: 279out:
275 path_release(&nd); 280 path_release(&nd);
276 return ERR_PTR(err); 281 return err;
277} 282}
278 283
279static void jffs2_put_super (struct super_block *sb) 284static void jffs2_put_super (struct super_block *sb)
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index db6f41d6dd60..18a28137b90e 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -565,10 +565,11 @@ static void jfs_unlockfs(struct super_block *sb)
565 } 565 }
566} 566}
567 567
568static struct super_block *jfs_get_sb(struct file_system_type *fs_type, 568static int jfs_get_sb(struct file_system_type *fs_type,
569 int flags, const char *dev_name, void *data) 569 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
570{ 570{
571 return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super); 571 return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super,
572 mnt);
572} 573}
573 574
574static int jfs_sync_fs(struct super_block *sb, int wait) 575static int jfs_sync_fs(struct super_block *sb, int wait)
diff --git a/fs/libfs.c b/fs/libfs.c
index 7145ba7a48d0..7d70efa46da9 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -196,9 +196,9 @@ struct inode_operations simple_dir_inode_operations = {
196 * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that 196 * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that
197 * will never be mountable) 197 * will never be mountable)
198 */ 198 */
199struct super_block * 199int get_sb_pseudo(struct file_system_type *fs_type, char *name,
200get_sb_pseudo(struct file_system_type *fs_type, char *name, 200 struct super_operations *ops, unsigned long magic,
201 struct super_operations *ops, unsigned long magic) 201 struct vfsmount *mnt)
202{ 202{
203 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); 203 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
204 static struct super_operations default_ops = {.statfs = simple_statfs}; 204 static struct super_operations default_ops = {.statfs = simple_statfs};
@@ -207,7 +207,7 @@ get_sb_pseudo(struct file_system_type *fs_type, char *name,
207 struct qstr d_name = {.name = name, .len = strlen(name)}; 207 struct qstr d_name = {.name = name, .len = strlen(name)};
208 208
209 if (IS_ERR(s)) 209 if (IS_ERR(s))
210 return s; 210 return PTR_ERR(s);
211 211
212 s->s_flags = MS_NOUSER; 212 s->s_flags = MS_NOUSER;
213 s->s_maxbytes = ~0ULL; 213 s->s_maxbytes = ~0ULL;
@@ -232,12 +232,12 @@ get_sb_pseudo(struct file_system_type *fs_type, char *name,
232 d_instantiate(dentry, root); 232 d_instantiate(dentry, root);
233 s->s_root = dentry; 233 s->s_root = dentry;
234 s->s_flags |= MS_ACTIVE; 234 s->s_flags |= MS_ACTIVE;
235 return s; 235 return simple_set_mnt(mnt, s);
236 236
237Enomem: 237Enomem:
238 up_write(&s->s_umount); 238 up_write(&s->s_umount);
239 deactivate_super(s); 239 deactivate_super(s);
240 return ERR_PTR(-ENOMEM); 240 return -ENOMEM;
241} 241}
242 242
243int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 243int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 2dcccf1d1b7f..14f24dfbfe30 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -559,10 +559,11 @@ void minix_truncate(struct inode * inode)
559 V2_minix_truncate(inode); 559 V2_minix_truncate(inode);
560} 560}
561 561
562static struct super_block *minix_get_sb(struct file_system_type *fs_type, 562static int minix_get_sb(struct file_system_type *fs_type,
563 int flags, const char *dev_name, void *data) 563 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
564{ 564{
565 return get_sb_bdev(fs_type, flags, dev_name, data, minix_fill_super); 565 return get_sb_bdev(fs_type, flags, dev_name, data, minix_fill_super,
566 mnt);
566} 567}
567 568
568static struct file_system_type minix_fs_type = { 569static struct file_system_type minix_fs_type = {
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c
index 5b76ccd19e3f..9e44158a7540 100644
--- a/fs/msdos/namei.c
+++ b/fs/msdos/namei.c
@@ -661,11 +661,12 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent)
661 return 0; 661 return 0;
662} 662}
663 663
664static struct super_block *msdos_get_sb(struct file_system_type *fs_type, 664static int msdos_get_sb(struct file_system_type *fs_type,
665 int flags, const char *dev_name, 665 int flags, const char *dev_name,
666 void *data) 666 void *data, struct vfsmount *mnt)
667{ 667{
668 return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super); 668 return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super,
669 mnt);
669} 670}
670 671
671static struct file_system_type msdos_fs_type = { 672static struct file_system_type msdos_fs_type = {
diff --git a/fs/namespace.c b/fs/namespace.c
index bf478addb852..c13072a5f1ee 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -86,6 +86,15 @@ struct vfsmount *alloc_vfsmnt(const char *name)
86 return mnt; 86 return mnt;
87} 87}
88 88
89int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb)
90{
91 mnt->mnt_sb = sb;
92 mnt->mnt_root = dget(sb->s_root);
93 return 0;
94}
95
96EXPORT_SYMBOL(simple_set_mnt);
97
89void free_vfsmnt(struct vfsmount *mnt) 98void free_vfsmnt(struct vfsmount *mnt)
90{ 99{
91 kfree(mnt->mnt_devname); 100 kfree(mnt->mnt_devname);
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index a1f3e972c6ef..8db033fab3fd 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -957,10 +957,10 @@ out:
957 return result; 957 return result;
958} 958}
959 959
960static struct super_block *ncp_get_sb(struct file_system_type *fs_type, 960static int ncp_get_sb(struct file_system_type *fs_type,
961 int flags, const char *dev_name, void *data) 961 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
962{ 962{
963 return get_sb_nodev(fs_type, flags, data, ncp_fill_super); 963 return get_sb_nodev(fs_type, flags, data, ncp_fill_super, mnt);
964} 964}
965 965
966static struct file_system_type ncp_fs_type = { 966static struct file_system_type ncp_fs_type = {
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index d0b991a92327..ff645a961bc8 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1690,8 +1690,8 @@ static int nfs_compare_super(struct super_block *sb, void *data)
1690 return !nfs_compare_fh(&old->fh, &server->fh); 1690 return !nfs_compare_fh(&old->fh, &server->fh);
1691} 1691}
1692 1692
1693static struct super_block *nfs_get_sb(struct file_system_type *fs_type, 1693static int nfs_get_sb(struct file_system_type *fs_type,
1694 int flags, const char *dev_name, void *raw_data) 1694 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt)
1695{ 1695{
1696 int error; 1696 int error;
1697 struct nfs_server *server = NULL; 1697 struct nfs_server *server = NULL;
@@ -1699,14 +1699,14 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
1699 struct nfs_fh *root; 1699 struct nfs_fh *root;
1700 struct nfs_mount_data *data = raw_data; 1700 struct nfs_mount_data *data = raw_data;
1701 1701
1702 s = ERR_PTR(-EINVAL); 1702 error = -EINVAL;
1703 if (data == NULL) { 1703 if (data == NULL) {
1704 dprintk("%s: missing data argument\n", __FUNCTION__); 1704 dprintk("%s: missing data argument\n", __FUNCTION__);
1705 goto out_err; 1705 goto out_err_noserver;
1706 } 1706 }
1707 if (data->version <= 0 || data->version > NFS_MOUNT_VERSION) { 1707 if (data->version <= 0 || data->version > NFS_MOUNT_VERSION) {
1708 dprintk("%s: bad mount version\n", __FUNCTION__); 1708 dprintk("%s: bad mount version\n", __FUNCTION__);
1709 goto out_err; 1709 goto out_err_noserver;
1710 } 1710 }
1711 switch (data->version) { 1711 switch (data->version) {
1712 case 1: 1712 case 1:
@@ -1718,7 +1718,7 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
1718 dprintk("%s: mount structure version %d does not support NFSv3\n", 1718 dprintk("%s: mount structure version %d does not support NFSv3\n",
1719 __FUNCTION__, 1719 __FUNCTION__,
1720 data->version); 1720 data->version);
1721 goto out_err; 1721 goto out_err_noserver;
1722 } 1722 }
1723 data->root.size = NFS2_FHSIZE; 1723 data->root.size = NFS2_FHSIZE;
1724 memcpy(data->root.data, data->old_root.data, NFS2_FHSIZE); 1724 memcpy(data->root.data, data->old_root.data, NFS2_FHSIZE);
@@ -1727,24 +1727,24 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
1727 dprintk("%s: mount structure version %d does not support strong security\n", 1727 dprintk("%s: mount structure version %d does not support strong security\n",
1728 __FUNCTION__, 1728 __FUNCTION__,
1729 data->version); 1729 data->version);
1730 goto out_err; 1730 goto out_err_noserver;
1731 } 1731 }
1732 case 5: 1732 case 5:
1733 memset(data->context, 0, sizeof(data->context)); 1733 memset(data->context, 0, sizeof(data->context));
1734 } 1734 }
1735#ifndef CONFIG_NFS_V3 1735#ifndef CONFIG_NFS_V3
1736 /* If NFSv3 is not compiled in, return -EPROTONOSUPPORT */ 1736 /* If NFSv3 is not compiled in, return -EPROTONOSUPPORT */
1737 s = ERR_PTR(-EPROTONOSUPPORT); 1737 error = -EPROTONOSUPPORT;
1738 if (data->flags & NFS_MOUNT_VER3) { 1738 if (data->flags & NFS_MOUNT_VER3) {
1739 dprintk("%s: NFSv3 not compiled into kernel\n", __FUNCTION__); 1739 dprintk("%s: NFSv3 not compiled into kernel\n", __FUNCTION__);
1740 goto out_err; 1740 goto out_err_noserver;
1741 } 1741 }
1742#endif /* CONFIG_NFS_V3 */ 1742#endif /* CONFIG_NFS_V3 */
1743 1743
1744 s = ERR_PTR(-ENOMEM); 1744 error = -ENOMEM;
1745 server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); 1745 server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL);
1746 if (!server) 1746 if (!server)
1747 goto out_err; 1747 goto out_err_noserver;
1748 /* Zero out the NFS state stuff */ 1748 /* Zero out the NFS state stuff */
1749 init_nfsv4_state(server); 1749 init_nfsv4_state(server);
1750 server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); 1750 server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL);
@@ -1754,7 +1754,7 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
1754 root->size = data->root.size; 1754 root->size = data->root.size;
1755 else 1755 else
1756 root->size = NFS2_FHSIZE; 1756 root->size = NFS2_FHSIZE;
1757 s = ERR_PTR(-EINVAL); 1757 error = -EINVAL;
1758 if (root->size > sizeof(root->data)) { 1758 if (root->size > sizeof(root->data)) {
1759 dprintk("%s: invalid root filehandle\n", __FUNCTION__); 1759 dprintk("%s: invalid root filehandle\n", __FUNCTION__);
1760 goto out_err; 1760 goto out_err;
@@ -1770,15 +1770,20 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
1770 } 1770 }
1771 1771
1772 /* Fire up rpciod if not yet running */ 1772 /* Fire up rpciod if not yet running */
1773 s = ERR_PTR(rpciod_up()); 1773 error = rpciod_up();
1774 if (IS_ERR(s)) { 1774 if (error < 0) {
1775 dprintk("%s: couldn't start rpciod! Error = %ld\n", 1775 dprintk("%s: couldn't start rpciod! Error = %d\n",
1776 __FUNCTION__, PTR_ERR(s)); 1776 __FUNCTION__, error);
1777 goto out_err; 1777 goto out_err;
1778 } 1778 }
1779 1779
1780 s = sget(fs_type, nfs_compare_super, nfs_set_super, server); 1780 s = sget(fs_type, nfs_compare_super, nfs_set_super, server);
1781 if (IS_ERR(s) || s->s_root) 1781 if (IS_ERR(s)) {
1782 error = PTR_ERR(s);
1783 goto out_err_rpciod;
1784 }
1785
1786 if (s->s_root)
1782 goto out_rpciod_down; 1787 goto out_rpciod_down;
1783 1788
1784 s->s_flags = flags; 1789 s->s_flags = flags;
@@ -1787,15 +1792,22 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
1787 if (error) { 1792 if (error) {
1788 up_write(&s->s_umount); 1793 up_write(&s->s_umount);
1789 deactivate_super(s); 1794 deactivate_super(s);
1790 return ERR_PTR(error); 1795 return error;
1791 } 1796 }
1792 s->s_flags |= MS_ACTIVE; 1797 s->s_flags |= MS_ACTIVE;
1793 return s; 1798 return simple_set_mnt(mnt, s);
1799
1794out_rpciod_down: 1800out_rpciod_down:
1795 rpciod_down(); 1801 rpciod_down();
1802 kfree(server);
1803 return simple_set_mnt(mnt, s);
1804
1805out_err_rpciod:
1806 rpciod_down();
1796out_err: 1807out_err:
1797 kfree(server); 1808 kfree(server);
1798 return s; 1809out_err_noserver:
1810 return error;
1799} 1811}
1800 1812
1801static void nfs_kill_super(struct super_block *s) 1813static void nfs_kill_super(struct super_block *s)
@@ -2032,8 +2044,8 @@ nfs_copy_user_string(char *dst, struct nfs_string *src, int maxlen)
2032 return dst; 2044 return dst;
2033} 2045}
2034 2046
2035static struct super_block *nfs4_get_sb(struct file_system_type *fs_type, 2047static int nfs4_get_sb(struct file_system_type *fs_type,
2036 int flags, const char *dev_name, void *raw_data) 2048 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt)
2037{ 2049{
2038 int error; 2050 int error;
2039 struct nfs_server *server; 2051 struct nfs_server *server;
@@ -2043,16 +2055,16 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
2043 2055
2044 if (data == NULL) { 2056 if (data == NULL) {
2045 dprintk("%s: missing data argument\n", __FUNCTION__); 2057 dprintk("%s: missing data argument\n", __FUNCTION__);
2046 return ERR_PTR(-EINVAL); 2058 return -EINVAL;
2047 } 2059 }
2048 if (data->version <= 0 || data->version > NFS4_MOUNT_VERSION) { 2060 if (data->version <= 0 || data->version > NFS4_MOUNT_VERSION) {
2049 dprintk("%s: bad mount version\n", __FUNCTION__); 2061 dprintk("%s: bad mount version\n", __FUNCTION__);
2050 return ERR_PTR(-EINVAL); 2062 return -EINVAL;
2051 } 2063 }
2052 2064
2053 server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); 2065 server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL);
2054 if (!server) 2066 if (!server)
2055 return ERR_PTR(-ENOMEM); 2067 return -ENOMEM;
2056 /* Zero out the NFS state stuff */ 2068 /* Zero out the NFS state stuff */
2057 init_nfsv4_state(server); 2069 init_nfsv4_state(server);
2058 server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); 2070 server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL);
@@ -2074,33 +2086,41 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
2074 2086
2075 /* We now require that the mount process passes the remote address */ 2087 /* We now require that the mount process passes the remote address */
2076 if (data->host_addrlen != sizeof(server->addr)) { 2088 if (data->host_addrlen != sizeof(server->addr)) {
2077 s = ERR_PTR(-EINVAL); 2089 error = -EINVAL;
2078 goto out_free; 2090 goto out_free;
2079 } 2091 }
2080 if (copy_from_user(&server->addr, data->host_addr, sizeof(server->addr))) { 2092 if (copy_from_user(&server->addr, data->host_addr, sizeof(server->addr))) {
2081 s = ERR_PTR(-EFAULT); 2093 error = -EFAULT;
2082 goto out_free; 2094 goto out_free;
2083 } 2095 }
2084 if (server->addr.sin_family != AF_INET || 2096 if (server->addr.sin_family != AF_INET ||
2085 server->addr.sin_addr.s_addr == INADDR_ANY) { 2097 server->addr.sin_addr.s_addr == INADDR_ANY) {
2086 dprintk("%s: mount program didn't pass remote IP address!\n", 2098 dprintk("%s: mount program didn't pass remote IP address!\n",
2087 __FUNCTION__); 2099 __FUNCTION__);
2088 s = ERR_PTR(-EINVAL); 2100 error = -EINVAL;
2089 goto out_free; 2101 goto out_free;
2090 } 2102 }
2091 2103
2092 /* Fire up rpciod if not yet running */ 2104 /* Fire up rpciod if not yet running */
2093 s = ERR_PTR(rpciod_up()); 2105 error = rpciod_up();
2094 if (IS_ERR(s)) { 2106 if (error < 0) {
2095 dprintk("%s: couldn't start rpciod! Error = %ld\n", 2107 dprintk("%s: couldn't start rpciod! Error = %d\n",
2096 __FUNCTION__, PTR_ERR(s)); 2108 __FUNCTION__, error);
2097 goto out_free; 2109 goto out_free;
2098 } 2110 }
2099 2111
2100 s = sget(fs_type, nfs4_compare_super, nfs_set_super, server); 2112 s = sget(fs_type, nfs4_compare_super, nfs_set_super, server);
2101 2113 if (IS_ERR(s)) {
2102 if (IS_ERR(s) || s->s_root) 2114 error = PTR_ERR(s);
2103 goto out_free; 2115 goto out_free;
2116 }
2117
2118 if (s->s_root) {
2119 kfree(server->mnt_path);
2120 kfree(server->hostname);
2121 kfree(server);
2122 return simple_set_mnt(mnt, s);
2123 }
2104 2124
2105 s->s_flags = flags; 2125 s->s_flags = flags;
2106 2126
@@ -2108,17 +2128,17 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
2108 if (error) { 2128 if (error) {
2109 up_write(&s->s_umount); 2129 up_write(&s->s_umount);
2110 deactivate_super(s); 2130 deactivate_super(s);
2111 return ERR_PTR(error); 2131 return error;
2112 } 2132 }
2113 s->s_flags |= MS_ACTIVE; 2133 s->s_flags |= MS_ACTIVE;
2114 return s; 2134 return simple_set_mnt(mnt, s);
2115out_err: 2135out_err:
2116 s = (struct super_block *)p; 2136 error = PTR_ERR(p);
2117out_free: 2137out_free:
2118 kfree(server->mnt_path); 2138 kfree(server->mnt_path);
2119 kfree(server->hostname); 2139 kfree(server->hostname);
2120 kfree(server); 2140 kfree(server);
2121 return s; 2141 return error;
2122} 2142}
2123 2143
2124static void nfs4_kill_super(struct super_block *sb) 2144static void nfs4_kill_super(struct super_block *sb)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 3ef017b3b5bd..a1810e6a93e5 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -494,10 +494,10 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
494 return simple_fill_super(sb, 0x6e667364, nfsd_files); 494 return simple_fill_super(sb, 0x6e667364, nfsd_files);
495} 495}
496 496
497static struct super_block *nfsd_get_sb(struct file_system_type *fs_type, 497static int nfsd_get_sb(struct file_system_type *fs_type,
498 int flags, const char *dev_name, void *data) 498 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
499{ 499{
500 return get_sb_single(fs_type, flags, data, nfsd_fill_super); 500 return get_sb_single(fs_type, flags, data, nfsd_fill_super, mnt);
501} 501}
502 502
503static struct file_system_type nfsd_fs_type = { 503static struct file_system_type nfsd_fs_type = {
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 27833f6df49f..d5d5e969294f 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -3093,10 +3093,11 @@ struct kmem_cache *ntfs_index_ctx_cache;
3093/* Driver wide mutex. */ 3093/* Driver wide mutex. */
3094DEFINE_MUTEX(ntfs_lock); 3094DEFINE_MUTEX(ntfs_lock);
3095 3095
3096static struct super_block *ntfs_get_sb(struct file_system_type *fs_type, 3096static int ntfs_get_sb(struct file_system_type *fs_type,
3097 int flags, const char *dev_name, void *data) 3097 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
3098{ 3098{
3099 return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super); 3099 return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super,
3100 mnt);
3100} 3101}
3101 3102
3102static struct file_system_type ntfs_fs_type = { 3103static struct file_system_type ntfs_fs_type = {
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index 7e88e24b3471..7273d9fa6bab 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -574,10 +574,10 @@ static struct inode_operations dlmfs_file_inode_operations = {
574 .getattr = simple_getattr, 574 .getattr = simple_getattr,
575}; 575};
576 576
577static struct super_block *dlmfs_get_sb(struct file_system_type *fs_type, 577static int dlmfs_get_sb(struct file_system_type *fs_type,
578 int flags, const char *dev_name, void *data) 578 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
579{ 579{
580 return get_sb_nodev(fs_type, flags, data, dlmfs_fill_super); 580 return get_sb_nodev(fs_type, flags, data, dlmfs_fill_super, mnt);
581} 581}
582 582
583static struct file_system_type dlmfs_fs_type = { 583static struct file_system_type dlmfs_fs_type = {
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 949b3dac30f1..788b8b50dc4c 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -672,12 +672,14 @@ read_super_error:
672 return status; 672 return status;
673} 673}
674 674
675static struct super_block *ocfs2_get_sb(struct file_system_type *fs_type, 675static int ocfs2_get_sb(struct file_system_type *fs_type,
676 int flags, 676 int flags,
677 const char *dev_name, 677 const char *dev_name,
678 void *data) 678 void *data,
679 struct vfsmount *mnt)
679{ 680{
680 return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super); 681 return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super,
682 mnt);
681} 683}
682 684
683static struct file_system_type ocfs2_fs_type = { 685static struct file_system_type ocfs2_fs_type = {
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index 0f14276a2e51..464e2bce0203 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -1054,10 +1054,10 @@ out_no_root:
1054 return -ENOMEM; 1054 return -ENOMEM;
1055} 1055}
1056 1056
1057static struct super_block *openprom_get_sb(struct file_system_type *fs_type, 1057static int openprom_get_sb(struct file_system_type *fs_type,
1058 int flags, const char *dev_name, void *data) 1058 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
1059{ 1059{
1060 return get_sb_single(fs_type, flags, data, openprom_fill_super); 1060 return get_sb_single(fs_type, flags, data, openprom_fill_super, mnt);
1061} 1061}
1062 1062
1063static struct file_system_type openprom_fs_type = { 1063static struct file_system_type openprom_fs_type = {
diff --git a/fs/pipe.c b/fs/pipe.c
index 5acd8954aaa0..20352573e025 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -979,12 +979,11 @@ no_files:
979 * any operations on the root directory. However, we need a non-trivial 979 * any operations on the root directory. However, we need a non-trivial
980 * d_name - pipe: will go nicely and kill the special-casing in procfs. 980 * d_name - pipe: will go nicely and kill the special-casing in procfs.
981 */ 981 */
982 982static int pipefs_get_sb(struct file_system_type *fs_type,
983static struct super_block * 983 int flags, const char *dev_name, void *data,
984pipefs_get_sb(struct file_system_type *fs_type, int flags, 984 struct vfsmount *mnt)
985 const char *dev_name, void *data)
986{ 985{
987 return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC); 986 return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC, mnt);
988} 987}
989 988
990static struct file_system_type pipe_fs_type = { 989static struct file_system_type pipe_fs_type = {
diff --git a/fs/proc/root.c b/fs/proc/root.c
index c3fd3611112f..9995356ce73e 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -26,10 +26,10 @@ struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc
26struct proc_dir_entry *proc_sys_root; 26struct proc_dir_entry *proc_sys_root;
27#endif 27#endif
28 28
29static struct super_block *proc_get_sb(struct file_system_type *fs_type, 29static int proc_get_sb(struct file_system_type *fs_type,
30 int flags, const char *dev_name, void *data) 30 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
31{ 31{
32 return get_sb_single(fs_type, flags, data, proc_fill_super); 32 return get_sb_single(fs_type, flags, data, proc_fill_super, mnt);
33} 33}
34 34
35static struct file_system_type proc_fs_type = { 35static struct file_system_type proc_fs_type = {
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 2ecd46f85e9f..e6cca5cd4b44 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -561,10 +561,11 @@ static void destroy_inodecache(void)
561 "qnx4_inode_cache: not all structures were freed\n"); 561 "qnx4_inode_cache: not all structures were freed\n");
562} 562}
563 563
564static struct super_block *qnx4_get_sb(struct file_system_type *fs_type, 564static int qnx4_get_sb(struct file_system_type *fs_type,
565 int flags, const char *dev_name, void *data) 565 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
566{ 566{
567 return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super); 567 return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super,
568 mnt);
568} 569}
569 570
570static struct file_system_type qnx4_fs_type = { 571static struct file_system_type qnx4_fs_type = {
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 14bd2246fb6d..b9677335cc8d 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -185,16 +185,17 @@ static int ramfs_fill_super(struct super_block * sb, void * data, int silent)
185 return 0; 185 return 0;
186} 186}
187 187
188struct super_block *ramfs_get_sb(struct file_system_type *fs_type, 188int ramfs_get_sb(struct file_system_type *fs_type,
189 int flags, const char *dev_name, void *data) 189 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
190{ 190{
191 return get_sb_nodev(fs_type, flags, data, ramfs_fill_super); 191 return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt);
192} 192}
193 193
194static struct super_block *rootfs_get_sb(struct file_system_type *fs_type, 194static int rootfs_get_sb(struct file_system_type *fs_type,
195 int flags, const char *dev_name, void *data) 195 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
196{ 196{
197 return get_sb_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); 197 return get_sb_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super,
198 mnt);
198} 199}
199 200
200static struct file_system_type ramfs_fs_type = { 201static struct file_system_type ramfs_fs_type = {
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index cae2abbc0c71..f3ff41d33989 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2249,11 +2249,12 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
2249 2249
2250#endif 2250#endif
2251 2251
2252static struct super_block *get_super_block(struct file_system_type *fs_type, 2252static int get_super_block(struct file_system_type *fs_type,
2253 int flags, const char *dev_name, 2253 int flags, const char *dev_name,
2254 void *data) 2254 void *data, struct vfsmount *mnt)
2255{ 2255{
2256 return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super); 2256 return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super,
2257 mnt);
2257} 2258}
2258 2259
2259static int __init init_reiserfs_fs(void) 2260static int __init init_reiserfs_fs(void)
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 9b9eda7b335c..4d6cd6621062 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -607,10 +607,11 @@ static struct super_operations romfs_ops = {
607 .remount_fs = romfs_remount, 607 .remount_fs = romfs_remount,
608}; 608};
609 609
610static struct super_block *romfs_get_sb(struct file_system_type *fs_type, 610static int romfs_get_sb(struct file_system_type *fs_type,
611 int flags, const char *dev_name, void *data) 611 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
612{ 612{
613 return get_sb_bdev(fs_type, flags, dev_name, data, romfs_fill_super); 613 return get_sb_bdev(fs_type, flags, dev_name, data, romfs_fill_super,
614 mnt);
614} 615}
615 616
616static struct file_system_type romfs_fs_type = { 617static struct file_system_type romfs_fs_type = {
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c
index fdeabc0a34f7..4a37c2bbfa3f 100644
--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -782,10 +782,10 @@ out:
782 return error; 782 return error;
783} 783}
784 784
785static struct super_block *smb_get_sb(struct file_system_type *fs_type, 785static int smb_get_sb(struct file_system_type *fs_type,
786 int flags, const char *dev_name, void *data) 786 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
787{ 787{
788 return get_sb_nodev(fs_type, flags, data, smb_fill_super); 788 return get_sb_nodev(fs_type, flags, data, smb_fill_super, mnt);
789} 789}
790 790
791static struct file_system_type smb_fs_type = { 791static struct file_system_type smb_fs_type = {
diff --git a/fs/super.c b/fs/super.c
index 9d5c2add7228..324c2d232f54 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -231,7 +231,7 @@ void generic_shutdown_super(struct super_block *sb)
231 if (root) { 231 if (root) {
232 sb->s_root = NULL; 232 sb->s_root = NULL;
233 shrink_dcache_parent(root); 233 shrink_dcache_parent(root);
234 shrink_dcache_anon(sb); 234 shrink_dcache_sb(sb);
235 dput(root); 235 dput(root);
236 fsync_super(sb); 236 fsync_super(sb);
237 lock_super(sb); 237 lock_super(sb);
@@ -676,9 +676,10 @@ static void bdev_uevent(struct block_device *bdev, enum kobject_action action)
676 } 676 }
677} 677}
678 678
679struct super_block *get_sb_bdev(struct file_system_type *fs_type, 679int get_sb_bdev(struct file_system_type *fs_type,
680 int flags, const char *dev_name, void *data, 680 int flags, const char *dev_name, void *data,
681 int (*fill_super)(struct super_block *, void *, int)) 681 int (*fill_super)(struct super_block *, void *, int),
682 struct vfsmount *mnt)
682{ 683{
683 struct block_device *bdev; 684 struct block_device *bdev;
684 struct super_block *s; 685 struct super_block *s;
@@ -686,7 +687,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
686 687
687 bdev = open_bdev_excl(dev_name, flags, fs_type); 688 bdev = open_bdev_excl(dev_name, flags, fs_type);
688 if (IS_ERR(bdev)) 689 if (IS_ERR(bdev))
689 return (struct super_block *)bdev; 690 return PTR_ERR(bdev);
690 691
691 /* 692 /*
692 * once the super is inserted into the list by sget, s_umount 693 * once the super is inserted into the list by sget, s_umount
@@ -697,15 +698,17 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
697 s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); 698 s = sget(fs_type, test_bdev_super, set_bdev_super, bdev);
698 mutex_unlock(&bdev->bd_mount_mutex); 699 mutex_unlock(&bdev->bd_mount_mutex);
699 if (IS_ERR(s)) 700 if (IS_ERR(s))
700 goto out; 701 goto error_s;
701 702
702 if (s->s_root) { 703 if (s->s_root) {
703 if ((flags ^ s->s_flags) & MS_RDONLY) { 704 if ((flags ^ s->s_flags) & MS_RDONLY) {
704 up_write(&s->s_umount); 705 up_write(&s->s_umount);
705 deactivate_super(s); 706 deactivate_super(s);
706 s = ERR_PTR(-EBUSY); 707 error = -EBUSY;
708 goto error_bdev;
707 } 709 }
708 goto out; 710
711 close_bdev_excl(bdev);
709 } else { 712 } else {
710 char b[BDEVNAME_SIZE]; 713 char b[BDEVNAME_SIZE];
711 714
@@ -716,18 +719,21 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
716 if (error) { 719 if (error) {
717 up_write(&s->s_umount); 720 up_write(&s->s_umount);
718 deactivate_super(s); 721 deactivate_super(s);
719 s = ERR_PTR(error); 722 goto error;
720 } else {
721 s->s_flags |= MS_ACTIVE;
722 bdev_uevent(bdev, KOBJ_MOUNT);
723 } 723 }
724
725 s->s_flags |= MS_ACTIVE;
726 bdev_uevent(bdev, KOBJ_MOUNT);
724 } 727 }
725 728
726 return s; 729 return simple_set_mnt(mnt, s);
727 730
728out: 731error_s:
732 error = PTR_ERR(s);
733error_bdev:
729 close_bdev_excl(bdev); 734 close_bdev_excl(bdev);
730 return s; 735error:
736 return error;
731} 737}
732 738
733EXPORT_SYMBOL(get_sb_bdev); 739EXPORT_SYMBOL(get_sb_bdev);
@@ -744,15 +750,16 @@ void kill_block_super(struct super_block *sb)
744 750
745EXPORT_SYMBOL(kill_block_super); 751EXPORT_SYMBOL(kill_block_super);
746 752
747struct super_block *get_sb_nodev(struct file_system_type *fs_type, 753int get_sb_nodev(struct file_system_type *fs_type,
748 int flags, void *data, 754 int flags, void *data,
749 int (*fill_super)(struct super_block *, void *, int)) 755 int (*fill_super)(struct super_block *, void *, int),
756 struct vfsmount *mnt)
750{ 757{
751 int error; 758 int error;
752 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); 759 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
753 760
754 if (IS_ERR(s)) 761 if (IS_ERR(s))
755 return s; 762 return PTR_ERR(s);
756 763
757 s->s_flags = flags; 764 s->s_flags = flags;
758 765
@@ -760,10 +767,10 @@ struct super_block *get_sb_nodev(struct file_system_type *fs_type,
760 if (error) { 767 if (error) {
761 up_write(&s->s_umount); 768 up_write(&s->s_umount);
762 deactivate_super(s); 769 deactivate_super(s);
763 return ERR_PTR(error); 770 return error;
764 } 771 }
765 s->s_flags |= MS_ACTIVE; 772 s->s_flags |= MS_ACTIVE;
766 return s; 773 return simple_set_mnt(mnt, s);
767} 774}
768 775
769EXPORT_SYMBOL(get_sb_nodev); 776EXPORT_SYMBOL(get_sb_nodev);
@@ -773,94 +780,102 @@ static int compare_single(struct super_block *s, void *p)
773 return 1; 780 return 1;
774} 781}
775 782
776struct super_block *get_sb_single(struct file_system_type *fs_type, 783int get_sb_single(struct file_system_type *fs_type,
777 int flags, void *data, 784 int flags, void *data,
778 int (*fill_super)(struct super_block *, void *, int)) 785 int (*fill_super)(struct super_block *, void *, int),
786 struct vfsmount *mnt)
779{ 787{
780 struct super_block *s; 788 struct super_block *s;
781 int error; 789 int error;
782 790
783 s = sget(fs_type, compare_single, set_anon_super, NULL); 791 s = sget(fs_type, compare_single, set_anon_super, NULL);
784 if (IS_ERR(s)) 792 if (IS_ERR(s))
785 return s; 793 return PTR_ERR(s);
786 if (!s->s_root) { 794 if (!s->s_root) {
787 s->s_flags = flags; 795 s->s_flags = flags;
788 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 796 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
789 if (error) { 797 if (error) {
790 up_write(&s->s_umount); 798 up_write(&s->s_umount);
791 deactivate_super(s); 799 deactivate_super(s);
792 return ERR_PTR(error); 800 return error;
793 } 801 }
794 s->s_flags |= MS_ACTIVE; 802 s->s_flags |= MS_ACTIVE;
795 } 803 }
796 do_remount_sb(s, flags, data, 0); 804 do_remount_sb(s, flags, data, 0);
797 return s; 805 return simple_set_mnt(mnt, s);
798} 806}
799 807
800EXPORT_SYMBOL(get_sb_single); 808EXPORT_SYMBOL(get_sb_single);
801 809
802struct vfsmount * 810struct vfsmount *
803do_kern_mount(const char *fstype, int flags, const char *name, void *data) 811vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
804{ 812{
805 struct file_system_type *type = get_fs_type(fstype);
806 struct super_block *sb = ERR_PTR(-ENOMEM);
807 struct vfsmount *mnt; 813 struct vfsmount *mnt;
808 int error;
809 char *secdata = NULL; 814 char *secdata = NULL;
815 int error;
810 816
811 if (!type) 817 if (!type)
812 return ERR_PTR(-ENODEV); 818 return ERR_PTR(-ENODEV);
813 819
820 error = -ENOMEM;
814 mnt = alloc_vfsmnt(name); 821 mnt = alloc_vfsmnt(name);
815 if (!mnt) 822 if (!mnt)
816 goto out; 823 goto out;
817 824
818 if (data) { 825 if (data) {
819 secdata = alloc_secdata(); 826 secdata = alloc_secdata();
820 if (!secdata) { 827 if (!secdata)
821 sb = ERR_PTR(-ENOMEM);
822 goto out_mnt; 828 goto out_mnt;
823 }
824 829
825 error = security_sb_copy_data(type, data, secdata); 830 error = security_sb_copy_data(type, data, secdata);
826 if (error) { 831 if (error)
827 sb = ERR_PTR(error);
828 goto out_free_secdata; 832 goto out_free_secdata;
829 }
830 } 833 }
831 834
832 sb = type->get_sb(type, flags, name, data); 835 error = type->get_sb(type, flags, name, data, mnt);
833 if (IS_ERR(sb)) 836 if (error < 0)
834 goto out_free_secdata; 837 goto out_free_secdata;
835 error = security_sb_kern_mount(sb, secdata); 838
839 error = security_sb_kern_mount(mnt->mnt_sb, secdata);
836 if (error) 840 if (error)
837 goto out_sb; 841 goto out_sb;
838 mnt->mnt_sb = sb; 842
839 mnt->mnt_root = dget(sb->s_root); 843 mnt->mnt_mountpoint = mnt->mnt_root;
840 mnt->mnt_mountpoint = sb->s_root;
841 mnt->mnt_parent = mnt; 844 mnt->mnt_parent = mnt;
842 up_write(&sb->s_umount); 845 up_write(&mnt->mnt_sb->s_umount);
843 free_secdata(secdata); 846 free_secdata(secdata);
844 put_filesystem(type);
845 return mnt; 847 return mnt;
846out_sb: 848out_sb:
847 up_write(&sb->s_umount); 849 dput(mnt->mnt_root);
848 deactivate_super(sb); 850 up_write(&mnt->mnt_sb->s_umount);
849 sb = ERR_PTR(error); 851 deactivate_super(mnt->mnt_sb);
850out_free_secdata: 852out_free_secdata:
851 free_secdata(secdata); 853 free_secdata(secdata);
852out_mnt: 854out_mnt:
853 free_vfsmnt(mnt); 855 free_vfsmnt(mnt);
854out: 856out:
857 return ERR_PTR(error);
858}
859
860EXPORT_SYMBOL_GPL(vfs_kern_mount);
861
862struct vfsmount *
863do_kern_mount(const char *fstype, int flags, const char *name, void *data)
864{
865 struct file_system_type *type = get_fs_type(fstype);
866 struct vfsmount *mnt;
867 if (!type)
868 return ERR_PTR(-ENODEV);
869 mnt = vfs_kern_mount(type, flags, name, data);
855 put_filesystem(type); 870 put_filesystem(type);
856 return (struct vfsmount *)sb; 871 return mnt;
857} 872}
858 873
859EXPORT_SYMBOL_GPL(do_kern_mount); 874EXPORT_SYMBOL_GPL(do_kern_mount);
860 875
861struct vfsmount *kern_mount(struct file_system_type *type) 876struct vfsmount *kern_mount(struct file_system_type *type)
862{ 877{
863 return do_kern_mount(type->name, 0, type->name, NULL); 878 return vfs_kern_mount(type, 0, type->name, NULL);
864} 879}
865 880
866EXPORT_SYMBOL(kern_mount); 881EXPORT_SYMBOL(kern_mount);
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index f1117e885bd6..40190c489271 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -66,10 +66,10 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
66 return 0; 66 return 0;
67} 67}
68 68
69static struct super_block *sysfs_get_sb(struct file_system_type *fs_type, 69static int sysfs_get_sb(struct file_system_type *fs_type,
70 int flags, const char *dev_name, void *data) 70 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
71{ 71{
72 return get_sb_single(fs_type, flags, data, sysfs_fill_super); 72 return get_sb_single(fs_type, flags, data, sysfs_fill_super, mnt);
73} 73}
74 74
75static struct file_system_type sysfs_fs_type = { 75static struct file_system_type sysfs_fs_type = {
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index e92b991e6dda..876639b93321 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -506,16 +506,17 @@ failed:
506 506
507/* Every kernel module contains stuff like this. */ 507/* Every kernel module contains stuff like this. */
508 508
509static struct super_block *sysv_get_sb(struct file_system_type *fs_type, 509static int sysv_get_sb(struct file_system_type *fs_type,
510 int flags, const char *dev_name, void *data) 510 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
511{ 511{
512 return get_sb_bdev(fs_type, flags, dev_name, data, sysv_fill_super); 512 return get_sb_bdev(fs_type, flags, dev_name, data, sysv_fill_super,
513 mnt);
513} 514}
514 515
515static struct super_block *v7_get_sb(struct file_system_type *fs_type, 516static int v7_get_sb(struct file_system_type *fs_type,
516 int flags, const char *dev_name, void *data) 517 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
517{ 518{
518 return get_sb_bdev(fs_type, flags, dev_name, data, v7_fill_super); 519 return get_sb_bdev(fs_type, flags, dev_name, data, v7_fill_super, mnt);
519} 520}
520 521
521static struct file_system_type sysv_fs_type = { 522static struct file_system_type sysv_fs_type = {
diff --git a/fs/udf/super.c b/fs/udf/super.c
index e45789fe38e8..2250774a831d 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -94,10 +94,10 @@ static unsigned int udf_count_free(struct super_block *);
94static int udf_statfs(struct super_block *, struct kstatfs *); 94static int udf_statfs(struct super_block *, struct kstatfs *);
95 95
96/* UDF filesystem type */ 96/* UDF filesystem type */
97static struct super_block *udf_get_sb(struct file_system_type *fs_type, 97static int udf_get_sb(struct file_system_type *fs_type,
98 int flags, const char *dev_name, void *data) 98 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
99{ 99{
100 return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super); 100 return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super, mnt);
101} 101}
102 102
103static struct file_system_type udf_fstype = { 103static struct file_system_type udf_fstype = {
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index db98a4c71e63..768fb8d9e67a 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1311,10 +1311,10 @@ out:
1311 1311
1312#endif 1312#endif
1313 1313
1314static struct super_block *ufs_get_sb(struct file_system_type *fs_type, 1314static int ufs_get_sb(struct file_system_type *fs_type,
1315 int flags, const char *dev_name, void *data) 1315 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
1316{ 1316{
1317 return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super); 1317 return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super, mnt);
1318} 1318}
1319 1319
1320static struct file_system_type ufs_fs_type = { 1320static struct file_system_type ufs_fs_type = {
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c
index a56cec3be5f0..9a8f48bae956 100644
--- a/fs/vfat/namei.c
+++ b/fs/vfat/namei.c
@@ -1023,11 +1023,12 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent)
1023 return 0; 1023 return 0;
1024} 1024}
1025 1025
1026static struct super_block *vfat_get_sb(struct file_system_type *fs_type, 1026static int vfat_get_sb(struct file_system_type *fs_type,
1027 int flags, const char *dev_name, 1027 int flags, const char *dev_name,
1028 void *data) 1028 void *data, struct vfsmount *mnt)
1029{ 1029{
1030 return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super); 1030 return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super,
1031 mnt);
1031} 1032}
1032 1033
1033static struct file_system_type vfat_fs_type = { 1034static struct file_system_type vfat_fs_type = {
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index f2a0778536f4..d03c89a36655 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -853,14 +853,16 @@ fail_vfsop:
853 return -error; 853 return -error;
854} 854}
855 855
856STATIC struct super_block * 856STATIC int
857xfs_fs_get_sb( 857xfs_fs_get_sb(
858 struct file_system_type *fs_type, 858 struct file_system_type *fs_type,
859 int flags, 859 int flags,
860 const char *dev_name, 860 const char *dev_name,
861 void *data) 861 void *data,
862 struct vfsmount *mnt)
862{ 863{
863 return get_sb_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super); 864 return get_sb_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super,
865 mnt);
864} 866}
865 867
866STATIC struct super_operations xfs_super_operations = { 868STATIC struct super_operations xfs_super_operations = {
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 46d0e079735d..0dd1610a94a9 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -217,7 +217,6 @@ extern struct dentry * d_alloc_anon(struct inode *);
217extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 217extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
218extern void shrink_dcache_sb(struct super_block *); 218extern void shrink_dcache_sb(struct super_block *);
219extern void shrink_dcache_parent(struct dentry *); 219extern void shrink_dcache_parent(struct dentry *);
220extern void shrink_dcache_anon(struct super_block *);
221extern int d_invalidate(struct dentry *); 220extern int d_invalidate(struct dentry *);
222 221
223/* only used at mount-time */ 222/* only used at mount-time */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 73c7d6f04b31..3e50dd24af87 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1269,23 +1269,26 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
1269struct file_system_type { 1269struct file_system_type {
1270 const char *name; 1270 const char *name;
1271 int fs_flags; 1271 int fs_flags;
1272 struct super_block *(*get_sb) (struct file_system_type *, int, 1272 int (*get_sb) (struct file_system_type *, int,
1273 const char *, void *); 1273 const char *, void *, struct vfsmount *);
1274 void (*kill_sb) (struct super_block *); 1274 void (*kill_sb) (struct super_block *);
1275 struct module *owner; 1275 struct module *owner;
1276 struct file_system_type * next; 1276 struct file_system_type * next;
1277 struct list_head fs_supers; 1277 struct list_head fs_supers;
1278}; 1278};
1279 1279
1280struct super_block *get_sb_bdev(struct file_system_type *fs_type, 1280extern int get_sb_bdev(struct file_system_type *fs_type,
1281 int flags, const char *dev_name, void *data, 1281 int flags, const char *dev_name, void *data,
1282 int (*fill_super)(struct super_block *, void *, int)); 1282 int (*fill_super)(struct super_block *, void *, int),
1283struct super_block *get_sb_single(struct file_system_type *fs_type, 1283 struct vfsmount *mnt);
1284extern int get_sb_single(struct file_system_type *fs_type,
1284 int flags, void *data, 1285 int flags, void *data,
1285 int (*fill_super)(struct super_block *, void *, int)); 1286 int (*fill_super)(struct super_block *, void *, int),
1286struct super_block *get_sb_nodev(struct file_system_type *fs_type, 1287 struct vfsmount *mnt);
1288extern int get_sb_nodev(struct file_system_type *fs_type,
1287 int flags, void *data, 1289 int flags, void *data,
1288 int (*fill_super)(struct super_block *, void *, int)); 1290 int (*fill_super)(struct super_block *, void *, int),
1291 struct vfsmount *mnt);
1289void generic_shutdown_super(struct super_block *sb); 1292void generic_shutdown_super(struct super_block *sb);
1290void kill_block_super(struct super_block *sb); 1293void kill_block_super(struct super_block *sb);
1291void kill_anon_super(struct super_block *sb); 1294void kill_anon_super(struct super_block *sb);
@@ -1296,8 +1299,10 @@ struct super_block *sget(struct file_system_type *type,
1296 int (*test)(struct super_block *,void *), 1299 int (*test)(struct super_block *,void *),
1297 int (*set)(struct super_block *,void *), 1300 int (*set)(struct super_block *,void *),
1298 void *data); 1301 void *data);
1299struct super_block *get_sb_pseudo(struct file_system_type *, char *, 1302extern int get_sb_pseudo(struct file_system_type *, char *,
1300 struct super_operations *ops, unsigned long); 1303 struct super_operations *ops, unsigned long,
1304 struct vfsmount *mnt);
1305extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1301int __put_super(struct super_block *sb); 1306int __put_super(struct super_block *sb);
1302int __put_super_and_need_restart(struct super_block *sb); 1307int __put_super_and_need_restart(struct super_block *sb);
1303void unnamed_dev_init(void); 1308void unnamed_dev_init(void);
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 78ecfa28b1c2..00b340ba6612 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -2,8 +2,8 @@
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev); 4struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev);
5struct super_block *ramfs_get_sb(struct file_system_type *fs_type, 5extern int ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data); 6 int flags, const char *dev_name, void *data, struct vfsmount *mnt);
7 7
8#ifndef CONFIG_MMU 8#ifndef CONFIG_MMU
9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, 9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 1511714a9585..0a2a24b6ebe4 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -205,11 +205,11 @@ static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
205 return 0; 205 return 0;
206} 206}
207 207
208static struct super_block *mqueue_get_sb(struct file_system_type *fs_type, 208static int mqueue_get_sb(struct file_system_type *fs_type,
209 int flags, const char *dev_name, 209 int flags, const char *dev_name,
210 void *data) 210 void *data, struct vfsmount *mnt)
211{ 211{
212 return get_sb_single(fs_type, flags, data, mqueue_fill_super); 212 return get_sb_single(fs_type, flags, data, mqueue_fill_super, mnt);
213} 213}
214 214
215static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) 215static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index ab81fdd4572b..77f45ffd5ea1 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -392,11 +392,11 @@ static int cpuset_fill_super(struct super_block *sb, void *unused_data,
392 return 0; 392 return 0;
393} 393}
394 394
395static struct super_block *cpuset_get_sb(struct file_system_type *fs_type, 395static int cpuset_get_sb(struct file_system_type *fs_type,
396 int flags, const char *unused_dev_name, 396 int flags, const char *unused_dev_name,
397 void *data) 397 void *data, struct vfsmount *mnt)
398{ 398{
399 return get_sb_single(fs_type, flags, data, cpuset_fill_super); 399 return get_sb_single(fs_type, flags, data, cpuset_fill_super, mnt);
400} 400}
401 401
402static struct file_system_type cpuset_fs_type = { 402static struct file_system_type cpuset_fs_type = {
diff --git a/kernel/futex.c b/kernel/futex.c
index 5699c512057b..e1a380c77a5a 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1056,11 +1056,11 @@ asmlinkage long sys_futex(u32 __user *uaddr, int op, int val,
1056 (unsigned long)uaddr2, val2, val3); 1056 (unsigned long)uaddr2, val2, val3);
1057} 1057}
1058 1058
1059static struct super_block * 1059static int futexfs_get_sb(struct file_system_type *fs_type,
1060futexfs_get_sb(struct file_system_type *fs_type, 1060 int flags, const char *dev_name, void *data,
1061 int flags, const char *dev_name, void *data) 1061 struct vfsmount *mnt)
1062{ 1062{
1063 return get_sb_pseudo(fs_type, "futex", NULL, 0xBAD1DEA); 1063 return get_sb_pseudo(fs_type, "futex", NULL, 0xBAD1DEA, mnt);
1064} 1064}
1065 1065
1066static struct file_system_type futex_fs_type = { 1066static struct file_system_type futex_fs_type = {
diff --git a/mm/shmem.c b/mm/shmem.c
index 1e43c8a865ba..7617bb1c6bf7 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2233,10 +2233,10 @@ static struct vm_operations_struct shmem_vm_ops = {
2233}; 2233};
2234 2234
2235 2235
2236static struct super_block *shmem_get_sb(struct file_system_type *fs_type, 2236static int shmem_get_sb(struct file_system_type *fs_type,
2237 int flags, const char *dev_name, void *data) 2237 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
2238{ 2238{
2239 return get_sb_nodev(fs_type, flags, data, shmem_fill_super); 2239 return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt);
2240} 2240}
2241 2241
2242static struct file_system_type tmpfs_fs_type = { 2242static struct file_system_type tmpfs_fs_type = {
diff --git a/net/socket.c b/net/socket.c
index 02948b622bd2..565f5e8d1191 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -335,10 +335,11 @@ static struct super_operations sockfs_ops = {
335 .statfs = simple_statfs, 335 .statfs = simple_statfs,
336}; 336};
337 337
338static struct super_block *sockfs_get_sb(struct file_system_type *fs_type, 338static int sockfs_get_sb(struct file_system_type *fs_type,
339 int flags, const char *dev_name, void *data) 339 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
340{ 340{
341 return get_sb_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC); 341 return get_sb_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC,
342 mnt);
342} 343}
343 344
344static struct vfsmount *sock_mnt __read_mostly; 345static struct vfsmount *sock_mnt __read_mostly;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index cc673dd8433f..8241fa726803 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -815,11 +815,11 @@ out:
815 return -ENOMEM; 815 return -ENOMEM;
816} 816}
817 817
818static struct super_block * 818static int
819rpc_get_sb(struct file_system_type *fs_type, 819rpc_get_sb(struct file_system_type *fs_type,
820 int flags, const char *dev_name, void *data) 820 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
821{ 821{
822 return get_sb_single(fs_type, flags, data, rpc_fill_super); 822 return get_sb_single(fs_type, flags, data, rpc_fill_super, mnt);
823} 823}
824 824
825static struct file_system_type rpc_pipe_fs_type = { 825static struct file_system_type rpc_pipe_fs_type = {
diff --git a/security/inode.c b/security/inode.c
index 0f77b0223662..e6fc29ac8564 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -135,11 +135,11 @@ static int fill_super(struct super_block *sb, void *data, int silent)
135 return simple_fill_super(sb, SECURITYFS_MAGIC, files); 135 return simple_fill_super(sb, SECURITYFS_MAGIC, files);
136} 136}
137 137
138static struct super_block *get_sb(struct file_system_type *fs_type, 138static int get_sb(struct file_system_type *fs_type,
139 int flags, const char *dev_name, 139 int flags, const char *dev_name,
140 void *data) 140 void *data, struct vfsmount *mnt)
141{ 141{
142 return get_sb_single(fs_type, flags, data, fill_super); 142 return get_sb_single(fs_type, flags, data, fill_super, mnt);
143} 143}
144 144
145static struct file_system_type fs_type = { 145static struct file_system_type fs_type = {
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 2e73d3279f2d..7029bbc9bef8 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1345,10 +1345,11 @@ err:
1345 goto out; 1345 goto out;
1346} 1346}
1347 1347
1348static struct super_block *sel_get_sb(struct file_system_type *fs_type, 1348static int sel_get_sb(struct file_system_type *fs_type,
1349 int flags, const char *dev_name, void *data) 1349 int flags, const char *dev_name, void *data,
1350 struct vfsmount *mnt)
1350{ 1351{
1351 return get_sb_single(fs_type, flags, data, sel_fill_super); 1352 return get_sb_single(fs_type, flags, data, sel_fill_super, mnt);
1352} 1353}
1353 1354
1354static struct file_system_type sel_fs_type = { 1355static struct file_system_type sel_fs_type = {