jbd2: add fast_commit space check
authorZhang Yi <yi.zhang@huawei.com>
Fri, 11 Aug 2023 06:36:05 +0000 (14:36 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 15 Aug 2023 13:00:33 +0000 (09:00 -0400)
commit0dbc759ae9971568af24def1b01d5b1aa87bd546
tree6b1fdcd8b63c5b2e9f3d64e0f4f86f450abf20c3
parent054d9c8fef14d476f1a9c6434de86813c5990052
jbd2: add fast_commit space check

If JBD2_FEATURE_INCOMPAT_FAST_COMMIT bit is set, it means the journal
have fast commit records need to recover, so the fast commit size
should not be too large, and the leftover normal journal size should
never less than JBD2_MIN_JOURNAL_BLOCKS. If it happens, the
journal->j_last is likely to be wrong and will probably lead to
incorrect journal recovery. So add a check into the
journal_check_superblock(), and drop the pointless check when
initializing the fastcommit parameters.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230811063610.2980059-8-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/jbd2/journal.c