]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: fast commit: make s_fc_lock reclaim-safe
authorLi Chen <me@linux.beauty>
Tue, 6 Jan 2026 12:06:21 +0000 (20:06 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 Jan 2026 03:46:05 +0000 (22:46 -0500)
commit491f2927ae097e2d405afe0b3fe841931ab8aad2
tree0debea93b6293134d7a9b00d89fc51d0ab28102a
parentbdc56a9c46b2a99c12313122b9352b619a2e719e
ext4: fast commit: make s_fc_lock reclaim-safe

s_fc_lock can be acquired from inode eviction and thus is
reclaim unsafe. Since the fast commit path holds s_fc_lock while writing
the commit log, allocations under the lock can enter reclaim and invert
the lock order with fs_reclaim. Add ext4_fc_lock()/ext4_fc_unlock()
helpers which acquire s_fc_lock under memalloc_nofs_save()/restore()
context and use them everywhere so allocations under the lock cannot
recurse into filesystem reclaim.

Fixes: 6593714d67ba ("ext4: hold s_fc_lock while during fast commit")
Signed-off-by: Li Chen <me@linux.beauty>
Reviewed-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260106120621.440126-1-me@linux.beauty
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/fast_commit.c