From 693bcf65312e202c15b2f291e1d105b5486cfeb9 Mon Sep 17 00:00:00 2001 From: Manfred Spraul Date: Thu, 30 Dec 2021 08:03:04 +0100 Subject: [PATCH 3/3] DEBUG patch: add printk to fs/jbd2/recovery.c debug printouts. --- fs/jbd2/journal.c | 2 +- fs/jbd2/recovery.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 35302bc192eb..58545fa74b9f 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -49,7 +49,7 @@ #include #ifdef CONFIG_JBD2_DEBUG -ushort jbd2_journal_enable_debug __read_mostly; +ushort jbd2_journal_enable_debug __read_mostly = 99; EXPORT_SYMBOL(jbd2_journal_enable_debug); module_param_named(jbd2_debug, jbd2_journal_enable_debug, ushort, 0644); diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 8ca3527189f8..b66884786cb9 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -428,6 +428,9 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) h->h_chksum[0] = 0; calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize); h->h_chksum[0] = provided; +if (provided != cpu_to_be32(calculated)) { +pr_info("commit_csum_verify error: provided %x.\n", provided); +} return provided == cpu_to_be32(calculated); } @@ -478,6 +481,7 @@ static int do_one_pass(journal_t *journal, sb = journal->j_superblock; next_commit_ID = be32_to_cpu(sb->s_sequence); +pr_info("next_commit_id: initial value %u.\n", (unsigned int) next_commit_ID); next_log_block = be32_to_cpu(sb->s_start); first_commit_ID = next_commit_ID; @@ -783,6 +787,7 @@ static int do_one_pass(journal_t *journal, brelse(bh); break; } +pr_info("crc32_sum %x found_csum %x.\n", crc32_sum, found_chksum); /* Neither checksum match nor unused? */ if (!((crc32_sum == found_chksum && @@ -800,22 +805,28 @@ static int do_one_pass(journal_t *journal, if (pass == PASS_SCAN && !jbd2_commit_block_csum_verify(journal, bh->b_data)) { +pr_info("direct block verify error.\n"); chksum_error: +pr_info("chksum_error.\n"); if (commit_time < last_trans_commit_time) goto ignore_crc_mismatch; +pr_info("error line 2.\n"); info->end_transaction = next_commit_ID; if (!jbd2_has_feature_async_commit(journal)) { +pr_info("error line 3.\n"); journal->j_failed_commit = next_commit_ID; brelse(bh); break; } +pr_info("error line 4.\n"); } if (pass == PASS_SCAN) last_trans_commit_time = commit_time; brelse(bh); next_commit_ID++; +pr_info("next_commit_id increased: %u.\n", (unsigned int) next_commit_ID); continue; case JBD2_REVOKE_BLOCK: @@ -859,10 +870,12 @@ static int do_one_pass(journal_t *journal, * log. If the latter happened, then we know that the "current" * transaction marks the end of the valid log. */ +pr_info("done, info->end_transaction is %ld.\n", (long)info->end_transaction); if (pass == PASS_SCAN) { if (!info->end_transaction) info->end_transaction = next_commit_ID; +pr_info("done with update, info->end_transaction is %ld.\n", (long)info->end_transaction); } else { /* It's really bad news if different passes end up at * different places (but possible due to IO errors). */ -- 2.33.1