Skip to content

Commit

Permalink
jbd2: only create debugfs and stats entries if init is successful
Browse files Browse the repository at this point in the history
jbd2 debugfs and stats entries should only be created if cache initialisation
is successful.  At the moment they are being created unconditionally which
will leave them dangling if cache (and hence module) initialisation fails.

Signed-off-by: Duane Griffin <duaneg@dghda.com>
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Duane Griffin authored and Theodore Ts'o committed Apr 30, 2008
1 parent 5648ba5 commit 620de4e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fs/jbd2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2307,10 +2307,12 @@ static int __init journal_init(void)
BUILD_BUG_ON(sizeof(struct journal_superblock_s) != 1024);

ret = journal_init_caches();
if (ret != 0)
if (ret == 0) {
jbd2_create_debugfs_entry();
jbd2_create_jbd_stats_proc_entry();
} else {
jbd2_journal_destroy_caches();
jbd2_create_debugfs_entry();
jbd2_create_jbd_stats_proc_entry();
}
return ret;
}

Expand Down

0 comments on commit 620de4e

Please sign in to comment.