]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
jbd2: do not try to recover wiped journal
authorJan Kara <jack@suse.cz>
Thu, 6 Feb 2025 09:46:59 +0000 (10:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:12:39 +0000 (11:12 +0200)
commit987217f85d8f9da29e271ee17caae0ab3a9897bc
tree75b27cdefaf2053fe53eb21239b364d5c316d7c3
parenta16f09df2baa5c5b2a78f122cfde83373a2e3b2e
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>
fs/jbd2/recovery.c