]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ext4: move pagecache_isize_extended() out of active handle
authorZhang Yi <yi.zhang@huawei.com>
Fri, 27 Mar 2026 10:29:38 +0000 (18:29 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 10 Apr 2026 01:57:52 +0000 (21:57 -0400)
commit1ad0f42823291bcac371dafd37533f5e8d92acc3
treec6bc6a1bd546ee6604ebc99c8d33456855fa79f1
parent116c0bdac2ec059d91045ba3f57cc90cb1e3b71d
ext4: move pagecache_isize_extended() out of active handle

In ext4_alloc_file_blocks(), pagecache_isize_extended() is called under
an active handle and may also hold folio lock if the block size is
smaller than the folio size. This also breaks the "folio lock ->
transaction start" lock ordering for the upcoming iomap buffered I/O
path.

Therefore, move pagecache_isize_extended() outside of an active handle.
Additionally, it is unnecessary to update the file length during each
iteration of the allocation loop. Instead, update the file length only
to the position where the allocation is successful. Postpone updating
the inode size until after the allocation loop completes or is
interrupted due to an error.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260327102939.1095257-13-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c