From patchwork Sun Jan 11 14:39:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 17809 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 166DEDDFBA for ; Mon, 12 Jan 2009 01:41:11 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751913AbZAKOlJ (ORCPT ); Sun, 11 Jan 2009 09:41:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751900AbZAKOlJ (ORCPT ); Sun, 11 Jan 2009 09:41:09 -0500 Received: from mx2.redhat.com ([66.187.237.31]:53539 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395AbZAKOlH (ORCPT ); Sun, 11 Jan 2009 09:41:07 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0BEejEg011811; Sun, 11 Jan 2009 09:40:45 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0BEejRp023231; Sun, 11 Jan 2009 09:40:45 -0500 Received: from unused (unused [10.11.231.15] (may be forged)) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0BEei2I022569; Sun, 11 Jan 2009 09:40:44 -0500 Date: Sun, 11 Jan 2009 09:39:42 -0500 From: Josef Bacik To: Akinobu Mita Cc: Josef Bacik , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Theodore Tso , adilger@sun.com, linux-ext4@vger.kernel.org Subject: Re: [PATCH] ext4: fix unhandled ext4_free_data allocation failure Message-ID: <20090111143942.GA28488@unused.rdu.redhat.com> References: <20081223104016.GC7217@localhost.localdomain> <20081223142915.GA23303@unused.rdu.redhat.com> <961aa3350812231437x4debaf9byf230a63582561010@mail.gmail.com> <20090111020352.GA4285@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090111020352.GA4285@localhost.localdomain> User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 > Cc: adilger@sun.com > Cc: linux-ext4@vger.kernel.org > Signed-off-by: Akinobu Mita 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 --- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;