aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
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/ext3
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/ext3')
-rw-r--r--fs/ext3/super.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index c5a52c9775a0..ac5c6b0ecd64 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1416,6 +1416,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1416 int i; 1416 int i;
1417 int needs_recovery; 1417 int needs_recovery;
1418 __le32 features; 1418 __le32 features;
1419 int err;
1419 1420
1420 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 1421 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
1421 if (!sbi) 1422 if (!sbi)
@@ -1675,12 +1676,20 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1675 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 1676 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
1676 spin_lock_init(&sbi->s_next_gen_lock); 1677 spin_lock_init(&sbi->s_next_gen_lock);
1677 1678
1678 percpu_counter_init(&sbi->s_freeblocks_counter, 1679 err = percpu_counter_init(&sbi->s_freeblocks_counter,
1679 ext3_count_free_blocks(sb)); 1680 ext3_count_free_blocks(sb));
1680 percpu_counter_init(&sbi->s_freeinodes_counter, 1681 if (!err) {
1681 ext3_count_free_inodes(sb)); 1682 err = percpu_counter_init(&sbi->s_freeinodes_counter,
1682 percpu_counter_init(&sbi->s_dirs_counter, 1683 ext3_count_free_inodes(sb));
1683 ext3_count_dirs(sb)); 1684 }
1685 if (!err) {
1686 err = percpu_counter_init(&sbi->s_dirs_counter,
1687 ext3_count_dirs(sb));
1688 }
1689 if (err) {
1690 printk(KERN_ERR "EXT3-fs: insufficient memory\n");
1691 goto failed_mount3;
1692 }
1684 1693
1685 /* per fileystem reservation list head & lock */ 1694 /* per fileystem reservation list head & lock */
1686 spin_lock_init(&sbi->s_rsv_window_lock); 1695 spin_lock_init(&sbi->s_rsv_window_lock);