diff options
| author | Theodore Ts'o <tytso@mit.edu> | 2026-11-25 20:13:01 -0500 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2026-11-25 22:30:49 -0500 |
| commit | aceadbccd428fb8e6593b27a3091d961f80225d1 (patch) | |
| tree | 04c6ec0f05e755780c35f739a33448b9a9d97454 /include/uapi/linux/android | |
| parent | 43d2e9d3f4ba3eaaec7356a7537164865266dff5 (diff) | |
ext4: don't track metadata buffers on an inode during fast commit replay
Fast commit replay runs without a journal handle and before
EXT4_SB(sb)->s_journal is set, so it effectively runs in nojournal mode.
__ext4_handle_dirty_metadata() then hands every extent tree block and
directory block it dirties to mmb_mark_buffer_dirty().
Commit d4fdde3257a5 ("fs: set I_METADATA_WRITEBACK in
mmb_mark_buffer_dirty()") sets this flag on the inode, which can
trigger a NULL pointer dereference on a per-cpu pointer during the
fast commit replay. This is because the iput at the end of each fast
commit update triggers write_inode_now(), and with
I_METADATA_WRITEBACK set, writeback_single_inode() will end up calling
ext4_writepages(), before ext4_percpu_param_init() has initialized
s_writepages_rwsem.
A similar crash was fixed in commit 0ecd56573c1f ("ext4: Avoid
entering writeback paths during fastcommit replay") by not setting
this flag in ext4_mark_iloc_dirty(). This commit applies the same fix
to __ext4_handle_dirty_metadata().
Once the fast commit replay is complete, jbd2_journal_recover() syncs
and flushes the whole block device, o the buffer is still written out
before the mount proceeds.
Reproduced with generic/311 using "-O inline_data,fast_commit" (the
ext4/adv test configuration).
Fixes: d4fdde3257a5 ("fs: set I_METADATA_WRITEBACK in mmb_mark_buffer_dirty()")
Cc: stable@vger.kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include/uapi/linux/android')
0 files changed, 0 insertions, 0 deletions
