From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765078AbYCGBcH (ORCPT ); Thu, 6 Mar 2008 20:32:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758321AbYCGBbb (ORCPT ); Thu, 6 Mar 2008 20:31:31 -0500 Received: from kumera.dghda.com ([80.68.90.171]:1989 "EHLO kumera.dghda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757388AbYCGBba (ORCPT ); Thu, 6 Mar 2008 20:31:30 -0500 From: "Duane Griffin" To: linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Theodore Tso , sct@redhat.com, akpm@linux-foundation.org, adilger@clusterfs.com, Duane Griffin Subject: [PATCH 2/3] jbd2: replace potentially false assertion with if block Date: Fri, 7 Mar 2008 01:31:23 +0000 Message-Id: <1204853484-25968-2-git-send-email-duaneg@dghda.com> X-Mailer: git-send-email 1.5.3.7 In-Reply-To: <1204853484-25968-1-git-send-email-duaneg@dghda.com> References: <1204853484-25968-1-git-send-email-duaneg@dghda.com> Message-Id: <48afbb3a44aa24dc1e31835c14e86c3c6c1c3b0a.1204844851.git.duaneg@dghda.com> In-Reply-To: <5e28cd633c71f6354a203a43000cbe5fef045589.1204844851.git.duaneg@dghda.com> References: <5e28cd633c71f6354a203a43000cbe5fef045589.1204844851.git.duaneg@dghda.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If an error occurs during jbd2 cache initialisation it is possible for the journal_head_cache to be NULL when jbd2_journal_destroy_journal_head_cache is called. Replace the J_ASSERT with an if block to handle the situation correctly. Note that even with this fix things will break badly if jbd2 is statically compiled in and cache initialisation fails. Signed-off-by: Duane Griffin --- fs/jbd2/journal.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 96ba846..0d8a595 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1985,9 +1985,10 @@ static int journal_init_jbd2_journal_head_cache(void) static void jbd2_journal_destroy_jbd2_journal_head_cache(void) { - J_ASSERT(jbd2_journal_head_cache != NULL); - kmem_cache_destroy(jbd2_journal_head_cache); - jbd2_journal_head_cache = NULL; + if (jbd2_journal_head_cache) { + kmem_cache_destroy(jbd2_journal_head_cache); + jbd2_journal_head_cache = NULL; + } } /* -- 1.5.3.7