From: "Duane Griffin" <duaneg@dghda.com>
To: akpm@linux-foundation.org
Cc: Eric Sandeen <sandeen@redhat.com>,
cmm@us.ibm.com, sct@redhat.com, linux-ext4@vger.kernel.org,
Duane Griffin <duaneg@dghda.com>
Subject: [PATCH 3/3][v2] jbd: replace potentially false assertion with if block
Date: Mon, 12 May 2008 17:57:41 +0100 [thread overview]
Message-ID: <1210611461-8526-4-git-send-email-duaneg@dghda.com> (raw)
In-Reply-To: <1210611461-8526-3-git-send-email-duaneg@dghda.com>
If an error occurs during jbd cache initialisation it is possible for the
journal_head_cache to be NULL when 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 jbd is statically
compiled in and cache initialisation fails.
Signed-off-by: Duane Griffin <duaneg@dghda.com
---
fs/jbd/journal.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 1ecd005..f6a7c93 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -1641,9 +1641,10 @@ static int journal_init_journal_head_cache(void)
static void journal_destroy_journal_head_cache(void)
{
- J_ASSERT(journal_head_cache != NULL);
- kmem_cache_destroy(journal_head_cache);
- journal_head_cache = NULL;
+ if (journal_head_cache) {
+ kmem_cache_destroy(journal_head_cache);
+ journal_head_cache = NULL;
+ }
}
/*
--
1.5.3.7
prev parent reply other threads:[~2008-05-12 16:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 16:57 [PATCH 0/3][v2] jbd: jbd versions of queued jbd2 patches Duane Griffin
2008-05-12 16:57 ` [PATCH 1/3][v2] jbd: eliminate duplicated code in revocation table init/destroy functions Duane Griffin
2008-05-12 16:57 ` [PATCH 2/3][v2] jbd: tidy up revoke cache initialisation and destruction Duane Griffin
2008-05-12 16:57 ` Duane Griffin [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=1210611461-8526-4-git-send-email-duaneg@dghda.com \
--to=duaneg@dghda.com \
--cc=akpm@linux-foundation.org \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=sct@redhat.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).