aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/configfs')
-rw-r--r--fs/configfs/configfs_internal.h3
-rw-r--r--fs/configfs/dir.c14
-rw-r--r--fs/configfs/mount.c7
3 files changed, 11 insertions, 13 deletions
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index 37121c2be110..b5f0a3b91f18 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -58,7 +58,6 @@ struct configfs_dirent {
58extern struct mutex configfs_symlink_mutex; 58extern struct mutex configfs_symlink_mutex;
59extern spinlock_t configfs_dirent_lock; 59extern spinlock_t configfs_dirent_lock;
60 60
61extern struct vfsmount * configfs_mount;
62extern struct kmem_cache *configfs_dir_cachep; 61extern struct kmem_cache *configfs_dir_cachep;
63 62
64extern int configfs_is_root(struct config_item *item); 63extern int configfs_is_root(struct config_item *item);
@@ -80,7 +79,7 @@ extern const unsigned char * configfs_get_name(struct configfs_dirent *sd);
80extern void configfs_drop_dentry(struct configfs_dirent *sd, struct dentry *parent); 79extern void configfs_drop_dentry(struct configfs_dirent *sd, struct dentry *parent);
81extern int configfs_setattr(struct dentry *dentry, struct iattr *iattr); 80extern int configfs_setattr(struct dentry *dentry, struct iattr *iattr);
82 81
83extern int configfs_pin_fs(void); 82extern struct dentry *configfs_pin_fs(void);
84extern void configfs_release_fs(void); 83extern void configfs_release_fs(void);
85 84
86extern struct rw_semaphore configfs_rename_sem; 85extern struct rw_semaphore configfs_rename_sem;
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 6c560e77965c..7e6c52d8a207 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1075,16 +1075,15 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
1075 * Pin the configfs filesystem. This means we can safely access 1075 * Pin the configfs filesystem. This means we can safely access
1076 * the root of the configfs filesystem. 1076 * the root of the configfs filesystem.
1077 */ 1077 */
1078 ret = configfs_pin_fs(); 1078 root = configfs_pin_fs();
1079 if (ret) 1079 if (IS_ERR(root))
1080 return ret; 1080 return PTR_ERR(root);
1081 1081
1082 /* 1082 /*
1083 * Next, lock the root directory. We're going to check that the 1083 * Next, lock the root directory. We're going to check that the
1084 * subsystem is really registered, and so we need to lock out 1084 * subsystem is really registered, and so we need to lock out
1085 * configfs_[un]register_subsystem(). 1085 * configfs_[un]register_subsystem().
1086 */ 1086 */
1087 root = configfs_mount->mnt_root;
1088 mutex_lock(&root->d_inode->i_mutex); 1087 mutex_lock(&root->d_inode->i_mutex);
1089 1088
1090 root_sd = root->d_fsdata; 1089 root_sd = root->d_fsdata;
@@ -1673,14 +1672,13 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1673 struct dentry *root; 1672 struct dentry *root;
1674 struct configfs_dirent *sd; 1673 struct configfs_dirent *sd;
1675 1674
1676 err = configfs_pin_fs(); 1675 root = configfs_pin_fs();
1677 if (err) 1676 if (IS_ERR(root))
1678 return err; 1677 return PTR_ERR(root);
1679 1678
1680 if (!group->cg_item.ci_name) 1679 if (!group->cg_item.ci_name)
1681 group->cg_item.ci_name = group->cg_item.ci_namebuf; 1680 group->cg_item.ci_name = group->cg_item.ci_namebuf;
1682 1681
1683 root = configfs_mount->mnt_root;
1684 sd = root->d_fsdata; 1682 sd = root->d_fsdata;
1685 link_group(to_config_group(sd->s_element), group); 1683 link_group(to_config_group(sd->s_element), group);
1686 1684
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index cc829fc85d77..aee0a7ebbd8e 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -37,7 +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 kmem_cache *configfs_dir_cachep; 41struct kmem_cache *configfs_dir_cachep;
42static int configfs_mnt_count = 0; 42static int configfs_mnt_count = 0;
43 43
@@ -115,10 +115,11 @@ static struct file_system_type configfs_fs_type = {
115 .kill_sb = kill_litter_super, 115 .kill_sb = kill_litter_super,
116}; 116};
117 117
118int configfs_pin_fs(void) 118struct dentry *configfs_pin_fs(void)
119{ 119{
120 return simple_pin_fs(&configfs_fs_type, &configfs_mount, 120 int err = simple_pin_fs(&configfs_fs_type, &configfs_mount,
121 &configfs_mnt_count); 121 &configfs_mnt_count);
122 return err ? ERR_PTR(err) : configfs_mount->mnt_root;
122} 123}
123 124
124void configfs_release_fs(void) 125void configfs_release_fs(void)