linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
To: jing zhang <zj.barak@gmail.com>, Andreas Dilger <adilger@sun.com>
Cc: tytso@mit.edu, linux-ext4 <linux-ext4@vger.kernel.org>,
	Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Subject: Re: [PATCH] ext4: memory leakage in ext4_discard_preallocations
Date: Fri, 26 Mar 2010 14:07:31 +0530	[thread overview]
Message-ID: <87vdcjv5pw.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <ac8f92701003200705u2bb6b65p4adce7b79f250705@mail.gmail.com>

On Sat, 20 Mar 2010 22:05:13 +0800, jing zhang <zj.barak@gmail.com> wrote:
> 
> Evening,
> 
> Thanks Andreas and Ted for your good explanations to deal error in
> gentle way, and I got it that the chance may exist since the pa is not
> deleted from its group_list yet.
> 
> And it also seems that there is work deserved.
>        - zj
> 
> ---
> 
> --- linux-2.6.32/fs/ext4/mballoc.c	2009-12-03 11:51:22.000000000 +0800
> +++ fs/mballoc.c	2010-03-20 21:40:04.000000000 +0800
> @@ -3788,14 +3788,14 @@ repeat:
>  		err = ext4_mb_load_buddy(sb, group, &e4b);
>  		if (err) {
>  			ext4_error(sb, __func__, "Error in loading buddy "
> -					"information for %u", group);
> +			"information for group %u inode %lu", group, inode->i_ino);
>  			continue;
>  		}
> 
>  		bitmap_bh = ext4_read_block_bitmap(sb, group);
>  		if (bitmap_bh == NULL) {
>  			ext4_error(sb, __func__, "Error in reading block "
> -					"bitmap for %u", group);
> +			"bitmap for group %u inode %lu", group, inode->i_ino);
>  			ext4_mb_release_desc(&e4b);
>  			continue;
>  		}
> @@ -3811,6 +3811,14 @@ repeat:
>  		list_del(&pa->u.pa_tmp_list);
>  		call_rcu(&(pa)->u.pa_rcu, ext4_mb_pa_callback);
>  	}
> +	if (! list_empty(&list)) {
> +		/*
> +		 * we have to do something for the check in
> +		 * the function, ext4_mb_discard_group_preallocations()
> +		 */
> +		list_for_each_entry(pa, &list, u.pa_tmp_list)
> +			pa->pa_deleted = 0;
> +	}
>  	if (ac)
>  		kmem_cache_free(ext4_ac_cachep, ac);
>  }

Can you add a comment saying if we fail to load buddy or read block
bitmap we skip freeing the prealloc space. So mark it undeleted. The
prealloc space is still removed from the inode but it is linked to the
group prealloc list via (pa_group_list)


-aneesh

  reply	other threads:[~2010-03-26  8:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 12:39 [PATCH] ext4: memory leakage in ext4_discard_preallocations jing zhang
2010-03-18 17:46 ` tytso
2010-03-19 14:17   ` jing zhang
2010-03-19 17:27     ` Andreas Dilger
2010-03-20 14:05       ` jing zhang
2010-03-26  8:37         ` Aneesh Kumar K. V [this message]
2010-03-26 14:12           ` jing zhang

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=87vdcjv5pw.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).