[lkml]   [2008]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[RFC, PATCH 2/6] jbd: replace potentially false assertion with if block
    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

    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 <>

    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;
    + }


     \ /
      Last update: 2008-03-06 03:11    [W:0.021 / U:14.284 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site