From: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
To: jing zhang <zj.barak@gmail.com>, linux-ext4 <linux-ext4@vger.kernel.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>, Andreas Dilger <adilger@sun.com>,
Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Subject: Re: [PATCH] ext4: memory leakage in ext4_mb_init()
Date: Fri, 26 Mar 2010 14:24:38 +0530 [thread overview]
Message-ID: <87tys3v4xd.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <ac8f92701003210701j5926f2c4v843e36bc602a0444@mail.gmail.com>
On Sun, 21 Mar 2010 22:01:06 +0800, jing zhang <zj.barak@gmail.com> wrote:
> From: Jing Zhang <zj.barak@gmail.com>
>
> Date: Sun Mar 21 21:59:35 2010
>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Andreas Dilger <adilger@sun.com>
> Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
> Signed-off-by: Jing Zhang <zj.barak@gmail.com>
>
> ---
>
> --- linux-2.6.32/fs/ext4/mballoc.c 2009-12-03 11:51:22.000000000 +0800
> +++ ext4_mm_leak/mballoc3.c 2010-03-21 21:37:18.000000000 +0800
> @@ -2360,6 +2360,24 @@ err_freesgi:
> return -ENOMEM;
> }
>
> +static void ext4_mb_destroy_backend(struct super_block *sb)
> +{
> + ext4_group_t ngroups = ext4_get_groups_count(sb);
> + ext4_group_t i;
> + struct ext4_sb_info *sbi = EXT4_SB(sb);
> + int j;
> + int num_meta_group_infos = (ngroups + EXT4_DESC_PER_BLOCK(sb) -1)
> + >> EXT4_DESC_PER_BLOCK_BITS(sb);
> + for (i = 0; i < ngroups; i++)
> + kfree(ext4_get_group_info(sb, i));
> +
> + for (j = 0; j < num_meta_group_infos; j++)
> + kfree(sbi->s_group_info[j]);
> +
> + kfree(sbi->s_group_info);
> + iput(sbi->s_buddy_cache);
> +}
> +
> int ext4_mb_init(struct super_block *sb, int needs_recovery)
> {
> struct ext4_sb_info *sbi = EXT4_SB(sb);
> @@ -2419,6 +2437,7 @@ int ext4_mb_init(struct super_block *sb,
> if (sbi->s_locality_groups == NULL) {
> kfree(sbi->s_mb_offsets);
> kfree(sbi->s_mb_maxs);
> + ext4_mb_destroy_backend(sb);
> return -ENOMEM;
> }
> for_each_possible_cpu(i) {
A better fix would be move s_locality_group allocation before
ext4_mb_init_backend
-aneesh
prev parent reply other threads:[~2010-03-26 8:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-21 14:01 [PATCH] ext4: memory leakage in ext4_mb_init() jing zhang
2010-03-22 1:27 ` tytso
2010-03-23 12:47 ` jing zhang
2010-03-26 8:57 ` Aneesh Kumar K. V
2010-03-26 14:40 ` jing zhang
2010-03-28 8:13 ` jing zhang
2010-04-03 16:53 ` tytso
2010-04-04 1:05 ` jing zhang
2010-04-04 18:08 ` tytso
2010-04-05 3:53 ` jing zhang
2010-04-05 4:27 ` Eric Sandeen
2010-04-05 4:51 ` jing zhang
2010-04-05 4:59 ` Eric Sandeen
2010-04-05 5:08 ` jing zhang
2010-04-05 12:42 ` tytso
2010-04-06 13:43 ` jing zhang
2010-04-06 14:21 ` tytso
2010-04-07 16:34 ` jing zhang
2010-04-07 16:34 ` jing zhang
2010-04-05 5:18 ` jing zhang
2010-04-05 12:43 ` tytso
2010-03-26 8:54 ` Aneesh Kumar K. V [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tys3v4xd.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=adilger@sun.com \
--cc=linux-ext4@vger.kernel.org \
--cc=shaggy@linux.vnet.ibm.com \
--cc=tytso@mit.edu \
--cc=zj.barak@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.