aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 14:54:38 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 21:09:27 -0500
commit9e30cc9595303b27b48be49b7bcd4d0679e34253 (patch)
tree365ab498bd3ecc6d8bcf462be08913828cbf1396
parent51a35e9fd0f229d2f84455ee7e85a5d30fa35594 (diff)
sysfs, kernfs: no need to kern_mount() sysfs from sysfs_init()
It has been very long since sysfs depended on vfs to keep track of internal states and whether sysfs is mounted or not doesn't make any difference to sysfs's internal operation. In addition to init and filesystem type registration, sysfs_init() invokes kern_mount() to create in-kernel mount of sysfs. This internal mounting doesn't server any purpose anymore. Remove it. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/sysfs/mount.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index fcbe5e80aeeb..0c80f0379016 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -24,7 +24,6 @@
24#include "sysfs.h" 24#include "sysfs.h"
25 25
26 26
27static struct vfsmount *sysfs_mnt;
28struct kmem_cache *sysfs_dir_cachep; 27struct kmem_cache *sysfs_dir_cachep;
29 28
30static const struct super_operations sysfs_ops = { 29static const struct super_operations sysfs_ops = {
@@ -153,34 +152,26 @@ static struct file_system_type sysfs_fs_type = {
153 152
154int __init sysfs_init(void) 153int __init sysfs_init(void)
155{ 154{
156 int err = -ENOMEM; 155 int err;
157 156
158 sysfs_dir_cachep = kmem_cache_create("sysfs_dir_cache", 157 sysfs_dir_cachep = kmem_cache_create("sysfs_dir_cache",
159 sizeof(struct sysfs_dirent), 158 sizeof(struct sysfs_dirent),
160 0, 0, NULL); 159 0, 0, NULL);
161 if (!sysfs_dir_cachep) 160 if (!sysfs_dir_cachep)
162 goto out; 161 return -ENOMEM;
163 162
164 err = sysfs_inode_init(); 163 err = sysfs_inode_init();
165 if (err) 164 if (err)
166 goto out_err; 165 goto out_err;
167 166
168 err = register_filesystem(&sysfs_fs_type); 167 err = register_filesystem(&sysfs_fs_type);
169 if (!err) { 168 if (err)
170 sysfs_mnt = kern_mount(&sysfs_fs_type);
171 if (IS_ERR(sysfs_mnt)) {
172 printk(KERN_ERR "sysfs: could not mount!\n");
173 err = PTR_ERR(sysfs_mnt);
174 sysfs_mnt = NULL;
175 unregister_filesystem(&sysfs_fs_type);
176 goto out_err;
177 }
178 } else
179 goto out_err; 169 goto out_err;
180out: 170
181 return err; 171 return 0;
172
182out_err: 173out_err:
183 kmem_cache_destroy(sysfs_dir_cachep); 174 kmem_cache_destroy(sysfs_dir_cachep);
184 sysfs_dir_cachep = NULL; 175 sysfs_dir_cachep = NULL;
185 goto out; 176 return err;
186} 177}