diff options
Diffstat (limited to 'fs/anon_inodes.c')
| -rw-r--r-- | fs/anon_inodes.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 24084732b1d0..80ef38c73e5a 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
| @@ -41,19 +41,8 @@ static const struct dentry_operations anon_inodefs_dentry_operations = { | |||
| 41 | static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, | 41 | static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, |
| 42 | int flags, const char *dev_name, void *data) | 42 | int flags, const char *dev_name, void *data) |
| 43 | { | 43 | { |
| 44 | struct dentry *root; | 44 | return mount_pseudo(fs_type, "anon_inode:", NULL, |
| 45 | root = mount_pseudo(fs_type, "anon_inode:", NULL, | ||
| 46 | &anon_inodefs_dentry_operations, ANON_INODE_FS_MAGIC); | 45 | &anon_inodefs_dentry_operations, ANON_INODE_FS_MAGIC); |
| 47 | if (!IS_ERR(root)) { | ||
| 48 | struct super_block *s = root->d_sb; | ||
| 49 | anon_inode_inode = alloc_anon_inode(s); | ||
| 50 | if (IS_ERR(anon_inode_inode)) { | ||
| 51 | dput(root); | ||
| 52 | deactivate_locked_super(s); | ||
| 53 | root = ERR_CAST(anon_inode_inode); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | return root; | ||
| 57 | } | 46 | } |
| 58 | 47 | ||
| 59 | static struct file_system_type anon_inode_fs_type = { | 48 | static struct file_system_type anon_inode_fs_type = { |
| @@ -175,22 +164,15 @@ EXPORT_SYMBOL_GPL(anon_inode_getfd); | |||
| 175 | 164 | ||
| 176 | static int __init anon_inode_init(void) | 165 | static int __init anon_inode_init(void) |
| 177 | { | 166 | { |
| 178 | int error; | ||
| 179 | |||
| 180 | error = register_filesystem(&anon_inode_fs_type); | ||
| 181 | if (error) | ||
| 182 | goto err_exit; | ||
| 183 | anon_inode_mnt = kern_mount(&anon_inode_fs_type); | 167 | anon_inode_mnt = kern_mount(&anon_inode_fs_type); |
| 184 | if (IS_ERR(anon_inode_mnt)) { | 168 | if (IS_ERR(anon_inode_mnt)) |
| 185 | error = PTR_ERR(anon_inode_mnt); | 169 | panic("anon_inode_init() kernel mount failed (%ld)\n", PTR_ERR(anon_inode_mnt)); |
| 186 | goto err_unregister_filesystem; | ||
| 187 | } | ||
| 188 | return 0; | ||
| 189 | 170 | ||
| 190 | err_unregister_filesystem: | 171 | anon_inode_inode = alloc_anon_inode(anon_inode_mnt->mnt_sb); |
| 191 | unregister_filesystem(&anon_inode_fs_type); | 172 | if (IS_ERR(anon_inode_inode)) |
| 192 | err_exit: | 173 | panic("anon_inode_init() inode allocation failed (%ld)\n", PTR_ERR(anon_inode_inode)); |
| 193 | panic(KERN_ERR "anon_inode_init() failed (%d)\n", error); | 174 | |
| 175 | return 0; | ||
| 194 | } | 176 | } |
| 195 | 177 | ||
| 196 | fs_initcall(anon_inode_init); | 178 | fs_initcall(anon_inode_init); |
