
From: Heiko Carstens <heiko.carstens@de.ibm.com>

The patch below fixes an ext2/ext3 memory leak: the *_fill_super functions
allocate percpu data structures but don't free them in *_put_super.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/ext2/super.c |    3 +++
 25-akpm/fs/ext3/super.c |    3 +++
 2 files changed, 6 insertions(+)

diff -puN fs/ext2/super.c~fix-ext2-ext3-memory-leak fs/ext2/super.c
--- 25/fs/ext2/super.c~fix-ext2-ext3-memory-leak	Thu Dec  9 13:07:12 2004
+++ 25-akpm/fs/ext2/super.c	Thu Dec  9 13:07:12 2004
@@ -122,6 +122,9 @@ static void ext2_put_super (struct super
 			brelse (sbi->s_group_desc[i]);
 	kfree(sbi->s_group_desc);
 	kfree(sbi->s_debts);
+	percpu_counter_destroy(&sbi->s_freeblocks_counter);
+	percpu_counter_destroy(&sbi->s_freeinodes_counter);
+	percpu_counter_destroy(&sbi->s_dirs_counter);
 	brelse (sbi->s_sbh);
 	sb->s_fs_info = NULL;
 	kfree(sbi);
diff -puN fs/ext3/super.c~fix-ext2-ext3-memory-leak fs/ext3/super.c
--- 25/fs/ext3/super.c~fix-ext2-ext3-memory-leak	Thu Dec  9 13:07:12 2004
+++ 25-akpm/fs/ext3/super.c	Thu Dec  9 13:07:12 2004
@@ -400,6 +400,9 @@ void ext3_put_super (struct super_block 
 	for (i = 0; i < sbi->s_gdb_count; i++)
 		brelse(sbi->s_group_desc[i]);
 	kfree(sbi->s_group_desc);
+	percpu_counter_destroy(&sbi->s_freeblocks_counter);
+	percpu_counter_destroy(&sbi->s_freeinodes_counter);
+	percpu_counter_destroy(&sbi->s_dirs_counter);
 	brelse(sbi->s_sbh);
 #ifdef CONFIG_QUOTA
 	for (i = 0; i < MAXQUOTAS; i++) {
_
