The patch titled ext3 percpu counter init leak fix has been removed from the -mm tree. Its filename is percpu-counter-data-type-changes-to-suppport-fix-fix-fix.patch This patch was probably dropped from -mm because it has now been merged into a subsystem tree or into Linus's tree, or because it was folded into its parent patch in the -mm tree. ------------------------------------------------------ Subject: ext3 percpu counter init leak fix From: Mingming Cao <cmm@xxxxxxxxxx> On Fri, 2006-04-28 at 23:28 -0700, Andrew Morton wrote: > Mingming Cao <cmm@xxxxxxxxxx> wrote: > > > > diff -puN fs/ext3/super.c~ext3_late_percpu_counter_fix fs/ext3/super.c > > --- linux-2.6.16/fs/ext3/super.c~ext3_late_percpu_counter_fix 2006-04-28 > > 08:27:31.000000000 -0700 > > +++ linux-2.6.16-cmm/fs/ext3/super.c 2006-04-28 08:54:12.000000000 -0700 > > @@ -1602,6 +1602,14 @@ static int ext3_fill_super (struct super > > sbi->s_gdb_count = db_count; > > get_random_bytes(&sbi->s_next_generation, sizeof(u32)); > > spin_lock_init(&sbi->s_next_gen_lock); > > + > > + percpu_counter_init(&sbi->s_freeblocks_counter, > > + ext3_count_free_blocks(sb)); > > + percpu_counter_init(&sbi->s_freeinodes_counter, > > + ext3_count_free_inodes(sb)); > > + percpu_counter_init(&sbi->s_dirs_counter, > > + ext3_count_dirs(sb)); > > + > > /* per fileystem reservation list head & lock */ > > spin_lock_init(&sbi->s_rsv_window_lock); > > sbi->s_rsv_window_root = RB_ROOT; > > @@ -1724,13 +1732,6 @@ static int ext3_fill_super (struct super > > test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": > > "writeback"); > > > > - percpu_counter_init(&sbi->s_freeblocks_counter, > > - ext3_count_free_blocks(sb)); > > - percpu_counter_init(&sbi->s_freeinodes_counter, > > - ext3_count_free_inodes(sb)); > > - percpu_counter_init(&sbi->s_dirs_counter, > > - ext3_count_dirs(sb)); > > - > > lock_kernel(); > > return 0; > > > > OK, but we're now leaking fbc->counters on a few error paths. You are right. The leak was introduced back after all these per cpu counter changes. Thanks for point this out. Fix the memory leak for percpu counter local counter on ext3/2_fill_super() some error paths. Signed-off-by: Mingming Cao <cmm@xxxxxxxxxx>- Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/ext2/super.c | 9 ++++++--- fs/ext3/super.c | 18 +++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff -puN fs/ext2/super.c~percpu-counter-data-type-changes-to-suppport-fix-fix-fix fs/ext2/super.c --- 25/fs/ext2/super.c~percpu-counter-data-type-changes-to-suppport-fix-fix-fix Mon May 1 15:02:21 2006 +++ 25-akpm/fs/ext2/super.c Mon May 1 15:02:21 2006 @@ -878,13 +878,13 @@ static int ext2_fill_super(struct super_ if (!sb->s_root) { iput(root); printk(KERN_ERR "EXT2-fs: get root inode failed\n"); - goto failed_mount2; + goto failed_mount3; } if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { dput(sb->s_root); sb->s_root = NULL; printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n"); - goto failed_mount2; + goto failed_mount3; } if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) ext2_warning(sb, __FUNCTION__, @@ -897,7 +897,10 @@ cantfind_ext2: printk("VFS: Can't find an ext2 filesystem on dev %s.\n", sb->s_id); goto failed_mount; - +failed_mount3: + percpu_counter_destroy(&sbi->s_freeblocks_counter); + percpu_counter_destroy(&sbi->s_freeinodes_counter); + percpu_counter_destroy(&sbi->s_dirs_counter); failed_mount2: for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); diff -puN fs/ext3/super.c~percpu-counter-data-type-changes-to-suppport-fix-fix-fix fs/ext3/super.c --- 25/fs/ext3/super.c~percpu-counter-data-type-changes-to-suppport-fix-fix-fix Mon May 1 15:02:21 2006 +++ 25-akpm/fs/ext3/super.c Mon May 1 15:02:21 2006 @@ -1645,16 +1645,16 @@ static int ext3_fill_super (struct super if (!test_opt(sb, NOLOAD) && EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { if (ext3_load_journal(sb, es, journal_devnum)) - goto failed_mount2; + goto failed_mount3; } else if (journal_inum) { if (ext3_create_journal(sb, es, journal_inum)) - goto failed_mount2; + goto failed_mount3; } else { if (!silent) printk (KERN_ERR "ext3: No journal on filesystem on %s\n", sb->s_id); - goto failed_mount2; + goto failed_mount3; } /* We have now updated the journal if required, so we can @@ -1677,7 +1677,7 @@ static int ext3_fill_super (struct super (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { printk(KERN_ERR "EXT3-fs: Journal does not support " "requested data journaling mode\n"); - goto failed_mount3; + goto failed_mount4; } default: break; @@ -1700,13 +1700,13 @@ static int ext3_fill_super (struct super if (!sb->s_root) { printk(KERN_ERR "EXT3-fs: get root inode failed\n"); iput(root); - goto failed_mount3; + goto failed_mount4; } if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { dput(sb->s_root); sb->s_root = NULL; printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); - goto failed_mount3; + goto failed_mount4; } ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); @@ -1738,8 +1738,12 @@ cantfind_ext3: sb->s_id); goto failed_mount; -failed_mount3: +failed_mount4: journal_destroy(sbi->s_journal); +failed_mount3: + percpu_counter_destroy(&sbi->s_freeblocks_counter); + percpu_counter_destroy(&sbi->s_freeinodes_counter); + percpu_counter_destroy(&sbi->s_dirs_counter); failed_mount2: for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); _ Patches currently in -mm which might be from cmm@xxxxxxxxxx are percpu-counter-data-type-changes-to-suppport.patch percpu-counter-data-type-changes-to-suppport-fix-fix-fix.patch avoid-disk-sector_t-overflow-for-2tb-ext3-filesystem.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html