diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2013-06-12 23:04:04 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-06-12 23:04:04 -0400 |
commit | 169f1a2a87aae44034da4b9f81be1683d33de6d0 (patch) | |
tree | d6283b5c33699eaf22ea52c3298d38be0152059d /fs/jbd2 | |
parent | c9b3a8ccb77e063a28a9567eb72e0c1222c4ade4 (diff) |
jbd2: use a single printk for jbd_debug()
Since the jbd_debug() is implemented with two separate printk()
calls, it can lead to corrupted and misleading debug output like
the following (see lines marked with "*"):
[ 290.339362] (fs/jbd2/journal.c, 203): kjournald2: kjournald2 wakes
[ 290.339365] (fs/jbd2/journal.c, 155): kjournald2: commit_sequence=42103, commit_request=42104
[ 290.339369] (fs/jbd2/journal.c, 158): kjournald2: OK, requests differ
[* 290.339376] (fs/jbd2/journal.c, 648): jbd2_log_wait_commit:
[* 290.339379] (fs/jbd2/commit.c, 370): jbd2_journal_commit_transaction: JBD2: want 42104, j_commit_sequence=42103
[* 290.339382] JBD2: starting commit of transaction 42104
[ 290.339410] (fs/jbd2/revoke.c, 566): jbd2_journal_write_revoke_records: Wrote 0 revoke records
[ 290.376555] (fs/jbd2/commit.c, 1088): jbd2_journal_commit_transaction: JBD2: commit 42104 complete, head 42079
i.e. the debug output from log_wait_commit and journal_commit_transaction
have become interleaved. The output should have been:
(fs/jbd2/journal.c, 648): jbd2_log_wait_commit: JBD2: want 42104, j_commit_sequence=42103
(fs/jbd2/commit.c, 370): jbd2_journal_commit_transaction: JBD2: starting commit of transaction 42104
It is expected that this is not easy to replicate -- I was only able
to cause it on preempt-rt kernels, and even then only under heavy
I/O load.
Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Suggested-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/journal.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 0e6c13bdcc14..915dd575cd46 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -103,6 +103,24 @@ EXPORT_SYMBOL(jbd2_inode_cache); | |||
103 | static void __journal_abort_soft (journal_t *journal, int errno); | 103 | static void __journal_abort_soft (journal_t *journal, int errno); |
104 | static int jbd2_journal_create_slab(size_t slab_size); | 104 | static int jbd2_journal_create_slab(size_t slab_size); |
105 | 105 | ||
106 | #ifdef CONFIG_JBD2_DEBUG | ||
107 | void __jbd2_debug(int level, const char *file, const char *func, | ||
108 | unsigned int line, const char *fmt, ...) | ||
109 | { | ||
110 | struct va_format vaf; | ||
111 | va_list args; | ||
112 | |||
113 | if (level > jbd2_journal_enable_debug) | ||
114 | return; | ||
115 | va_start(args, fmt); | ||
116 | vaf.fmt = fmt; | ||
117 | vaf.va = &args; | ||
118 | printk(KERN_DEBUG "%s: (%s, %u): %pV\n", file, func, line, &vaf); | ||
119 | va_end(args); | ||
120 | } | ||
121 | EXPORT_SYMBOL(__jbd2_debug); | ||
122 | #endif | ||
123 | |||
106 | /* Checksumming functions */ | 124 | /* Checksumming functions */ |
107 | int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb) | 125 | int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb) |
108 | { | 126 | { |