diff options
| author | Zhang Yi <yi.zhang@huawei.com> | 2026-09-03 20:35:39 +0800 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2026-10-08 11:11:26 -0400 |
| commit | 7e6b2d5ae79a8060610fb20fc4690ece412403cb (patch) | |
| tree | 670144c12c41a951084eeab45c976f9587239c6e /include | |
| parent | d8938e95403ed7888b80cb39d7e7e047a493161e (diff) | |
| download | linux-next-7e6b2d5ae79a8060610fb20fc4690ece412403cb.tar.gz linux-next-7e6b2d5ae79a8060610fb20fc4690ece412403cb.zip | |
ext4: set DISKSIZE_GROW_PENDING after zeroing unaligned EOF block
In the iomap buffered I/O path, data=ordered mode is not used, so the
zeroed EOF block has no implicit ordering with later i_disksize updates.
Without the pending state being set, i_disksize can be advanced past the
zeroed block before writeback completes, exposing stale data after a
crash.
Previous patches added the consumer side of the
disksize-grow-pending mechanism: the state bit, clear and wait helpers,
and ioend tagging. Now add ext4_iomap_mark_disksize_pending() and call
it from ext4_block_zero_eof() after zeroing the tail of the block that
straddles i_disksize.
The helper locks the folio, waits for any in-flight writeback on it to
complete, then sets EXT4_STATE_DISKSIZE_GROW_PENDING only if the folio
is still dirty. Waiting for writeback prevents folio_test_dirty() from
returning false mid-writeback, which would cause us to skip the pending
state while zeroed data is still in flight. The dirty check then avoids
setting the bit when the data has already been written back.
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20260903123543.2302999-28-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
