aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/configfs/mount.c')
-rw-r--r--fs/configfs/mount.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 276e15cafd58..aee0a7ebbd8e 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -37,8 +37,7 @@
37/* Random magic number */ 37/* Random magic number */
38#define CONFIGFS_MAGIC 0x62656570 38#define CONFIGFS_MAGIC 0x62656570
39 39
40struct vfsmount * configfs_mount = NULL; 40static struct vfsmount *configfs_mount = NULL;
41struct super_block * configfs_sb = NULL;
42struct kmem_cache *configfs_dir_cachep; 41struct kmem_cache *configfs_dir_cachep;
43static int configfs_mnt_count = 0; 42static int configfs_mnt_count = 0;
44 43
@@ -77,12 +76,11 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
77 sb->s_magic = CONFIGFS_MAGIC; 76 sb->s_magic = CONFIGFS_MAGIC;
78 sb->s_op = &configfs_ops; 77 sb->s_op = &configfs_ops;
79 sb->s_time_gran = 1; 78 sb->s_time_gran = 1;
80 configfs_sb = sb;
81 79
82 inode = configfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, 80 inode = configfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
83 &configfs_root); 81 &configfs_root, sb);
84 if (inode) { 82 if (inode) {
85 inode->i_op = &configfs_dir_inode_operations; 83 inode->i_op = &configfs_root_inode_operations;
86 inode->i_fop = &configfs_dir_operations; 84 inode->i_fop = &configfs_dir_operations;
87 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 85 /* directory inodes start off with i_nlink == 2 (for "." entry) */
88 inc_nlink(inode); 86 inc_nlink(inode);
@@ -91,10 +89,9 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
91 return -ENOMEM; 89 return -ENOMEM;
92 } 90 }
93 91
94 root = d_alloc_root(inode); 92 root = d_make_root(inode);
95 if (!root) { 93 if (!root) {
96 pr_debug("%s: could not get root dentry!\n",__func__); 94 pr_debug("%s: could not get root dentry!\n",__func__);
97 iput(inode);
98 return -ENOMEM; 95 return -ENOMEM;
99 } 96 }
100 config_group_init(&configfs_root_group); 97 config_group_init(&configfs_root_group);
@@ -118,10 +115,11 @@ static struct file_system_type configfs_fs_type = {
118 .kill_sb = kill_litter_super, 115 .kill_sb = kill_litter_super,
119}; 116};
120 117
121int configfs_pin_fs(void) 118struct dentry *configfs_pin_fs(void)
122{ 119{
123 return simple_pin_fs(&configfs_fs_type, &configfs_mount, 120 int err = simple_pin_fs(&configfs_fs_type, &configfs_mount,
124 &configfs_mnt_count); 121 &configfs_mnt_count);
122 return err ? ERR_PTR(err) : configfs_mount->mnt_root;
125} 123}
126 124
127void configfs_release_fs(void) 125void configfs_release_fs(void)