LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Duane Griffin" <duaneg@dghda.com>
To: linux-ext4@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Theodore Tso <tytso@mit.edu>,
sct@redhat.com, akpm@linux-foundation.org, adilger@clusterfs.com,
Duane Griffin <duaneg@dghda.com>
Subject: [RFC, PATCH 2/6] jbd: replace potentially false assertion with if block
Date: Thu, 6 Mar 2008 01:59:10 +0000 [thread overview]
Message-ID: <1204768754-29655-3-git-send-email-duaneg@dghda.com> (raw)
Message-ID: <7fbb2f28dcb417e3173ffacc103932c36683f2f0.1204685366.git.duaneg@dghda.com> (raw)
In-Reply-To: <1204768754-29655-2-git-send-email-duaneg@dghda.com>
In-Reply-To: <a047dfbd7855d5f484ae8a3434f6a073302505be.1204685366.git.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 ext3 is statically
compiled in and cache initialisation fails.
Signed-off-by: Duane Griffin <duaneg@dghda.com>
---
At the moment the cache destruction methods are inconsistent in whether they
set the cache pointers to NULL after destroying them. To be precise,
journal_destroy_handle_cache doesn't, the others do. I haven't changed that,
although I was sorely tempted. I think it would be better to be consistent and
that NULLing the pointers is preferable. Any objections?
This patch is an independent bug fix and following patches in this series do
not depend on it.
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 3943a89..3f334a3 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -1635,9 +1635,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-03-06 2:07 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-06 1:59 [RFC, PATCH 0/6] ext3: do not modify data on-disk when mounting read-only filesystem Duane Griffin
[not found] ` <1204768754-29655-2-git-send-email-duaneg@dghda.com>
2008-03-06 1:59 ` [RFC, PATCH 1/6] jbd: eliminate duplicated code in revocation table init/destroy functions Duane Griffin
[not found] ` <1204768754-29655-3-git-send-email-duaneg@dghda.com>
2008-03-06 1:59 ` [RFC, PATCH 2/6] jbd: replace potentially false assertion with if block Duane Griffin
2008-03-08 14:52 ` Christoph Hellwig
[not found] ` <1204768754-29655-4-git-send-email-duaneg@dghda.com>
2008-03-06 1:59 ` [RFC, PATCH 3/6] jbd: only create debugfs entries if cache initialisation is successful Duane Griffin
[not found] ` <1204768754-29655-5-git-send-email-duaneg@dghda.com>
2008-03-06 1:59 ` [RFC, PATCH 4/6] jbd: refactor nested journal log recovery loop into separate functions Duane Griffin
2008-03-08 14:53 ` Christoph Hellwig
2008-03-08 18:40 ` Duane Griffin
2008-03-11 14:35 ` Jan Kara
2008-03-12 1:02 ` Duane Griffin
2008-03-12 10:50 ` Jan Kara
[not found] ` <1204768754-29655-6-git-send-email-duaneg@dghda.com>
2008-03-06 1:59 ` [RFC, PATCH 5/6] jbd: add support for read-only log recovery Duane Griffin
2008-03-11 15:05 ` Jan Kara
2008-03-12 1:40 ` Duane Griffin
2008-03-12 10:51 ` Jan Kara
[not found] ` <1204768754-29655-7-git-send-email-duaneg@dghda.com>
2008-03-06 1:59 ` [RFC, PATCH 6/6] ext3: do not write to the disk when mounting a dirty read-only filesystem Duane Griffin
2008-03-06 7:17 ` Andreas Dilger
2008-03-06 11:19 ` Duane Griffin
2008-03-11 15:11 ` Jan Kara
2008-03-12 2:42 ` Duane Griffin
2008-03-12 10:53 ` Jan Kara
2008-03-06 3:42 ` [RFC, PATCH 0/6] ext3: do not modify data on-disk when mounting " Andrew Morton
2008-03-06 11:20 ` Duane Griffin
2008-03-13 3:22 ` Daniel Phillips
2008-03-13 12:35 ` Duane Griffin
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=1204768754-29655-3-git-send-email-duaneg@dghda.com \
--to=duaneg@dghda.com \
--cc=adilger@clusterfs.com \
--cc=akpm@linux-foundation.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sct@redhat.com \
--cc=tytso@mit.edu \
--subject='Re: [RFC, PATCH 2/6] jbd: replace potentially false assertion with if block' \
/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
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).