aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/super.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-17 02:25:45 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:44 -0400
commit833f4077bf7c2dcff6e31526e03ec2ad91c88581 (patch)
tree80916540be846267342c3e5e4a6255c2c18b44d5 /fs/ext2/super.c
parentbf1d89c81352f6eca72d0c10cfee3dba29ef5efb (diff)
lib: percpu_counter_init error handling
alloc_percpu can fail, propagate that error. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext2/super.c')
-rw-r--r--fs/ext2/super.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 639a32c3c9c1..2690e460f2ef 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -653,6 +653,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
653 int db_count; 653 int db_count;
654 int i, j; 654 int i, j;
655 __le32 features; 655 __le32 features;
656 int err;
656 657
657 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 658 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
658 if (!sbi) 659 if (!sbi)
@@ -906,12 +907,20 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
906 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 907 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
907 spin_lock_init(&sbi->s_next_gen_lock); 908 spin_lock_init(&sbi->s_next_gen_lock);
908 909
909 percpu_counter_init(&sbi->s_freeblocks_counter, 910 err = percpu_counter_init(&sbi->s_freeblocks_counter,
910 ext2_count_free_blocks(sb)); 911 ext2_count_free_blocks(sb));
911 percpu_counter_init(&sbi->s_freeinodes_counter, 912 if (!err) {
913 err = percpu_counter_init(&sbi->s_freeinodes_counter,
912 ext2_count_free_inodes(sb)); 914 ext2_count_free_inodes(sb));
913 percpu_counter_init(&sbi->s_dirs_counter, 915 }
916 if (!err) {
917 err = percpu_counter_init(&sbi->s_dirs_counter,
914 ext2_count_dirs(sb)); 918 ext2_count_dirs(sb));
919 }
920 if (err) {
921 printk(KERN_ERR "EXT2-fs: insufficient memory\n");
922 goto failed_mount3;
923 }
915 /* 924 /*
916 * set up enough so that it can read an inode 925 * set up enough so that it can read an inode
917 */ 926 */