Commit 7c6455e368bc87ef38df7b6ddba2339a67107bdf

Authored by Al Viro
1 parent 988f032567

configfs: register_filesystem() called too early

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 2 changed files with 18 additions and 20 deletions Side-by-side Diff

... ... @@ -292,7 +292,7 @@
292 292 return bdi_init(&configfs_backing_dev_info);
293 293 }
294 294  
295   -void __exit configfs_inode_exit(void)
  295 +void configfs_inode_exit(void)
296 296 {
297 297 bdi_destroy(&configfs_backing_dev_info);
298 298 }
... ... @@ -143,28 +143,26 @@
143 143 goto out;
144 144  
145 145 config_kobj = kobject_create_and_add("config", kernel_kobj);
146   - if (!config_kobj) {
147   - kmem_cache_destroy(configfs_dir_cachep);
148   - configfs_dir_cachep = NULL;
149   - goto out;
150   - }
  146 + if (!config_kobj)
  147 + goto out2;
151 148  
  149 + err = configfs_inode_init();
  150 + if (err)
  151 + goto out3;
  152 +
152 153 err = register_filesystem(&configfs_fs_type);
153   - if (err) {
154   - printk(KERN_ERR "configfs: Unable to register filesystem!\n");
155   - kobject_put(config_kobj);
156   - kmem_cache_destroy(configfs_dir_cachep);
157   - configfs_dir_cachep = NULL;
158   - goto out;
159   - }
  154 + if (err)
  155 + goto out4;
160 156  
161   - err = configfs_inode_init();
162   - if (err) {
163   - unregister_filesystem(&configfs_fs_type);
164   - kobject_put(config_kobj);
165   - kmem_cache_destroy(configfs_dir_cachep);
166   - configfs_dir_cachep = NULL;
167   - }
  157 + return 0;
  158 +out4:
  159 + printk(KERN_ERR "configfs: Unable to register filesystem!\n");
  160 + configfs_inode_exit();
  161 +out3:
  162 + kobject_put(config_kobj);
  163 +out2:
  164 + kmem_cache_destroy(configfs_dir_cachep);
  165 + configfs_dir_cachep = NULL;
168 166 out:
169 167 return err;
170 168 }