linux/fs/jbd2
Zhang Yi 18aba2adb3 jbd2: fix off-by-one while erasing journal
In __jbd2_journal_erase(), the block_stop parameter includes the last
block of a contiguous region; however, the calculation of byte_stop is
incorrect, as it does not account for the bytes in that last block.
Consequently, the page cache is not cleared properly, which occasionally
causes the ext4/050 test to fail.

Since block_stop operates on inclusion semantics, it involves repeated
increments and decrements by 1, significantly increasing the complexity
of the calculations. Optimize the calculation and fix the incorrect
byte_stop by make both block_stop and byte_stop to use exclusion
semantics.

This fixes a failure in fstests ext4/050.

Fixes: 01d5d96542 ("ext4: add discard/zeroout flags to journal flush")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20250217065955.3829229-1-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2025-03-18 00:15:25 -04:00
..
checkpoint.c ext4: fix incorrect tid assumption in jbd2_journal_shrink_checkpoint_list() 2024-08-26 23:39:48 -04:00
commit.c jbd2: Correct stale comment of release_buffer_page 2025-03-13 10:41:21 -04:00
journal.c jbd2: fix off-by-one while erasing journal 2025-03-18 00:15:25 -04:00
Kconfig jbd2: switch to using the crc32c library 2024-12-01 17:23:02 -08:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
recovery.c jbd2: do not try to recover wiped journal 2025-03-17 11:19:41 -04:00
revoke.c jbd2: correct stale function name in comment 2025-03-13 10:41:21 -04:00
transaction.c jbd2: correct stale function name in comment 2025-03-13 10:41:21 -04:00