diff options
Diffstat (limited to 'fs/ecryptfs/main.c')
-rw-r--r-- | fs/ecryptfs/main.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 567bc4b9f70a..760983d0f25e 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/key.h> | 35 | #include <linux/key.h> |
36 | #include <linux/parser.h> | 36 | #include <linux/parser.h> |
37 | #include <linux/fs_stack.h> | 37 | #include <linux/fs_stack.h> |
38 | #include <linux/slab.h> | ||
38 | #include "ecryptfs_kernel.h" | 39 | #include "ecryptfs_kernel.h" |
39 | 40 | ||
40 | /** | 41 | /** |
@@ -496,17 +497,25 @@ struct kmem_cache *ecryptfs_sb_info_cache; | |||
496 | static int | 497 | static int |
497 | ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent) | 498 | ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent) |
498 | { | 499 | { |
500 | struct ecryptfs_sb_info *esi; | ||
499 | int rc = 0; | 501 | int rc = 0; |
500 | 502 | ||
501 | /* Released in ecryptfs_put_super() */ | 503 | /* Released in ecryptfs_put_super() */ |
502 | ecryptfs_set_superblock_private(sb, | 504 | ecryptfs_set_superblock_private(sb, |
503 | kmem_cache_zalloc(ecryptfs_sb_info_cache, | 505 | kmem_cache_zalloc(ecryptfs_sb_info_cache, |
504 | GFP_KERNEL)); | 506 | GFP_KERNEL)); |
505 | if (!ecryptfs_superblock_to_private(sb)) { | 507 | esi = ecryptfs_superblock_to_private(sb); |
508 | if (!esi) { | ||
506 | ecryptfs_printk(KERN_WARNING, "Out of memory\n"); | 509 | ecryptfs_printk(KERN_WARNING, "Out of memory\n"); |
507 | rc = -ENOMEM; | 510 | rc = -ENOMEM; |
508 | goto out; | 511 | goto out; |
509 | } | 512 | } |
513 | |||
514 | rc = bdi_setup_and_register(&esi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); | ||
515 | if (rc) | ||
516 | goto out; | ||
517 | |||
518 | sb->s_bdi = &esi->bdi; | ||
510 | sb->s_op = &ecryptfs_sops; | 519 | sb->s_op = &ecryptfs_sops; |
511 | /* Released through deactivate_super(sb) from get_sb_nodev */ | 520 | /* Released through deactivate_super(sb) from get_sb_nodev */ |
512 | sb->s_root = d_alloc(NULL, &(const struct qstr) { | 521 | sb->s_root = d_alloc(NULL, &(const struct qstr) { |
@@ -585,8 +594,8 @@ out: | |||
585 | * with as much information as it can before needing | 594 | * with as much information as it can before needing |
586 | * the lower filesystem. | 595 | * the lower filesystem. |
587 | * ecryptfs_read_super(): this accesses the lower filesystem and uses | 596 | * ecryptfs_read_super(): this accesses the lower filesystem and uses |
588 | * ecryptfs_interpolate to perform most of the linking | 597 | * ecryptfs_interpose to perform most of the linking |
589 | * ecryptfs_interpolate(): links the lower filesystem into ecryptfs | 598 | * ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c) |
590 | */ | 599 | */ |
591 | static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, | 600 | static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, |
592 | const char *dev_name, void *raw_data, | 601 | const char *dev_name, void *raw_data, |