* [Patch] fix ext2/ext3 memory leak
@ 2004-12-09 16:48 Heiko Carstens
0 siblings, 0 replies; only message in thread
From: Heiko Carstens @ 2004-12-09 16:48 UTC (permalink / raw)
To: Andrew Morton, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 163 bytes --]
Hi,
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.
Thanks,
Heiko
[-- Attachment #2: 00_ext3.diff --]
[-- Type: text/plain, Size: 1260 bytes --]
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
diffstat:
fs/ext2/super.c | 3 +++
fs/ext3/super.c | 3 +++
2 files changed, 6 insertions(+)
diff -urN linux-2.6/fs/ext2/super.c linux-2.6-patched/fs/ext2/super.c
--- linux-2.6/fs/ext2/super.c 2004-12-09 17:41:49.000000000 +0100
+++ linux-2.6-patched/fs/ext2/super.c 2004-12-09 17:42:01.000000000 +0100
@@ -122,6 +122,9 @@
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 -urN linux-2.6/fs/ext3/super.c linux-2.6-patched/fs/ext3/super.c
--- linux-2.6/fs/ext3/super.c 2004-12-09 17:41:49.000000000 +0100
+++ linux-2.6-patched/fs/ext3/super.c 2004-12-09 17:42:01.000000000 +0100
@@ -400,6 +400,9 @@
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++) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-12-09 16:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-09 16:48 [Patch] fix ext2/ext3 memory leak Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®