mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-05 13:25:20 +02:00
jbd2: do not try to recover wiped journal
[ Upstream commit a662f3c03b754e1f97a2781fa242e95bdb139798 ] If a journal is wiped, we will set journal->j_tail to 0. However if 'write' argument is not set (as it happens for read-only device or for ocfs2), the on-disk superblock is not updated accordingly and thus jbd2_journal_recover() cat try to recover the wiped journal. Fix the check in jbd2_journal_recover() to use journal->j_tail for checking empty journal instead. Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Link: https://patch.msgid.link/20250206094657.20865-4-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5741b9d7bb
commit
ed88717950
|
@ -286,21 +286,22 @@ static int fc_do_one_pass(journal_t *journal,
|
|||
int jbd2_journal_recover(journal_t *journal)
|
||||
{
|
||||
int err, err2;
|
||||
journal_superblock_t * sb;
|
||||
|
||||
struct recovery_info info;
|
||||
errseq_t wb_err;
|
||||
struct address_space *mapping;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
sb = journal->j_superblock;
|
||||
|
||||
/*
|
||||
* The journal superblock's s_start field (the current log head)
|
||||
* is always zero if, and only if, the journal was cleanly
|
||||
* unmounted.
|
||||
* unmounted. We use its in-memory version j_tail here because
|
||||
* jbd2_journal_wipe() could have updated it without updating journal
|
||||
* superblock.
|
||||
*/
|
||||
if (!sb->s_start) {
|
||||
if (!journal->j_tail) {
|
||||
journal_superblock_t *sb = journal->j_superblock;
|
||||
|
||||
jbd2_debug(1, "No recovery required, last transaction %d, head block %u\n",
|
||||
be32_to_cpu(sb->s_sequence), be32_to_cpu(sb->s_head));
|
||||
journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user