Skip to content

Commit

Permalink
sysfs, kernfs: no need to kern_mount() sysfs from sysfs_init()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
htejun authored and gregkh committed Nov 30, 2013
1 parent 51a35e9 commit 9e30cc9
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions fs/sysfs/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "sysfs.h"


static struct vfsmount *sysfs_mnt;
struct kmem_cache *sysfs_dir_cachep;

static const struct super_operations sysfs_ops = {
Expand Down Expand Up @@ -153,34 +152,26 @@ static struct file_system_type sysfs_fs_type = {

int __init sysfs_init(void)
{
int err = -ENOMEM;
int err;

sysfs_dir_cachep = kmem_cache_create("sysfs_dir_cache",
sizeof(struct sysfs_dirent),
0, 0, NULL);
if (!sysfs_dir_cachep)
goto out;
return -ENOMEM;

err = sysfs_inode_init();
if (err)
goto out_err;

err = register_filesystem(&sysfs_fs_type);
if (!err) {
sysfs_mnt = kern_mount(&sysfs_fs_type);
if (IS_ERR(sysfs_mnt)) {
printk(KERN_ERR "sysfs: could not mount!\n");
err = PTR_ERR(sysfs_mnt);
sysfs_mnt = NULL;
unregister_filesystem(&sysfs_fs_type);
goto out_err;
}
} else
if (err)
goto out_err;
out:
return err;

return 0;

out_err:
kmem_cache_destroy(sysfs_dir_cachep);
sysfs_dir_cachep = NULL;
goto out;
return err;
}

0 comments on commit 9e30cc9

Please sign in to comment.