diff options
author | Zhang Yi <yi.zhang@huawei.com> | 2025-07-07 22:08:08 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-23 16:49:41 +0200 |
commit | ffb21eafbf4fc5d9ef7199ddd1ce5f05bd579958 (patch) | |
tree | badc679988846195975e650831fd7a70bf137071 /lib/zstd/common/debug.c | |
parent | ab13e8cc3fb228c7bc4a08aa309769cbe37729b8 (diff) |
ext4: restart handle if credits are insufficient during allocating blocks
commit e2c4c49dee64ca2f42ad2958cbe1805de96b6732 upstream.
After large folios are supported on ext4, writing back a sufficiently
large and discontinuous folio may consume a significant number of
journal credits, placing considerable strain on the journal. For
example, in a 20GB filesystem with 1K block size and 1MB journal size,
writing back a 2MB folio could require thousands of credits in the
worst-case scenario (when each block is discontinuous and distributed
across different block groups), potentially exceeding the journal size.
This issue can also occur in ext4_write_begin() and ext4_page_mkwrite()
when delalloc is not enabled.
Fix this by ensuring that there are sufficient journal credits before
allocating an extent in mpage_map_one_extent() and
ext4_block_write_begin(). If there are not enough credits, return
-EAGAIN, exit the current mapping loop, restart a new handle and a new
transaction, and allocating blocks on this folio again in the next
iteration.
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20250707140814.542883-6-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/zstd/common/debug.c')
0 files changed, 0 insertions, 0 deletions