All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Josef Bacik <jbacik@redhat.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Theodore Tso <tytso@mit.edu>,
	adilger@sun.com, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: fix unhandled ext4_free_data allocation failure
Date: Sun, 11 Jan 2009 08:46:32 -0600	[thread overview]
Message-ID: <496A0648.9050100@redhat.com> (raw)
In-Reply-To: <20090111143942.GA28488@unused.rdu.redhat.com>

Josef Bacik wrote:
> On Sun, Jan 11, 2009 at 11:03:53AM +0900, Akinobu Mita wrote:
>> In ext4_mb_free_blocks() ext4_free_data allocation failure
>> is not handled. This error handling cannot be simple error return because
>> ext4_mb_free_blocks() cannot fail.
>>
>> This patch add __GFP_NOFAIL to gfp mask for the allocation.
>>
>> Cc: Theodore Tso <tytso@mit.edu>
>> Cc: adilger@sun.com
>> Cc: linux-ext4@vger.kernel.org
>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> 
> Sorry but thats still not right, the fs should never force the box to come up
> with memory, it should be able to gracefully handle ENOMEM cases.  This patch
> does this properly.  Thanks,
> 
> Signed-off-by: Josef Bacik <jbacik@redhat.com>
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 918aec0..e97ea09 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -4886,6 +4886,10 @@ do_more:
>  		 * be used until this transaction is committed
>  		 */
>  		new_entry  = kmem_cache_alloc(ext4_free_ext_cachep, GFP_NOFS);
> +		if (!new_entry) {
> +			err = -ENOMEM;
> +			goto error_return;
> +		}
>  		new_entry->start_blk = bit;
>  		new_entry->group  = block_group;
>  		new_entry->count = count;

Well, this will now force a filesystem error (then remount-ro or panic
(or ignore) if the allocation fails.  I'm not sure that's better...?

-Eric

  reply	other threads:[~2009-01-11 14:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-23 10:40 [PATCH] ext4: annotate unhandled kmem_cache_alloc() error Akinobu Mita
2008-12-23 14:29 ` Josef Bacik
2008-12-23 22:37   ` Akinobu Mita
2009-01-11  2:03     ` [PATCH] ext4: fix unhandled ext4_free_data allocation failure Akinobu Mita
2009-01-11 14:39       ` Josef Bacik
2009-01-11 14:46         ` Eric Sandeen [this message]
2009-01-12  3:58           ` Theodore Tso
2009-01-12 15:03             ` Theodore Tso
2009-01-12 15:03               ` Theodore Tso

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=496A0648.9050100@redhat.com \
    --to=sandeen@redhat.com \
    --cc=adilger@sun.com \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jbacik@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.