diff options
Diffstat (limited to 'fs/ramfs')
-rw-r--r-- | fs/ramfs/inode.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index 8f7fe323e049..fb99863598be 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c | |||
@@ -249,7 +249,7 @@ static struct dentry *rootfs_mount(struct file_system_type *fs_type, | |||
249 | { | 249 | { |
250 | static unsigned long once; | 250 | static unsigned long once; |
251 | 251 | ||
252 | if (test_and_set_bit(1, &once)) | 252 | if (test_and_set_bit(0, &once)) |
253 | return ERR_PTR(-ENODEV); | 253 | return ERR_PTR(-ENODEV); |
254 | 254 | ||
255 | return mount_nodev(fs_type, flags, data, ramfs_fill_super); | 255 | return mount_nodev(fs_type, flags, data, ramfs_fill_super); |
@@ -275,21 +275,34 @@ static struct file_system_type rootfs_fs_type = { | |||
275 | 275 | ||
276 | static int __init init_ramfs_fs(void) | 276 | static int __init init_ramfs_fs(void) |
277 | { | 277 | { |
278 | return register_filesystem(&ramfs_fs_type); | 278 | static unsigned long once; |
279 | int err; | ||
280 | |||
281 | if (test_and_set_bit(0, &once)) | ||
282 | return 0; | ||
283 | |||
284 | err = bdi_init(&ramfs_backing_dev_info); | ||
285 | if (err) | ||
286 | return err; | ||
287 | |||
288 | err = register_filesystem(&ramfs_fs_type); | ||
289 | if (err) | ||
290 | bdi_destroy(&ramfs_backing_dev_info); | ||
291 | |||
292 | return err; | ||
279 | } | 293 | } |
280 | module_init(init_ramfs_fs) | 294 | module_init(init_ramfs_fs) |
281 | 295 | ||
282 | int __init init_rootfs(void) | 296 | int __init init_rootfs(void) |
283 | { | 297 | { |
284 | int err; | 298 | int err = register_filesystem(&rootfs_fs_type); |
285 | 299 | ||
286 | err = bdi_init(&ramfs_backing_dev_info); | ||
287 | if (err) | 300 | if (err) |
288 | return err; | 301 | return err; |
289 | 302 | ||
290 | err = register_filesystem(&rootfs_fs_type); | 303 | err = init_ramfs_fs(); |
291 | if (err) | 304 | if (err) |
292 | bdi_destroy(&ramfs_backing_dev_info); | 305 | unregister_filesystem(&rootfs_fs_type); |
293 | 306 | ||
294 | return err; | 307 | return err; |
295 | } | 308 | } |