mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
ext4: fix transaction overflow during writeback
Commit95ad8ee45c("ext4: correct the reserved credits for extent conversion") was correct to note that we need to reserve enough credits for all extents possibly underlying a large folio. However it was too eager to reduce the number of reserved credits. Extent conversion may not only need to touch several leaf extent blocks, it may also need to split extents - for example a single large unwritten extent may need to be split into many small written ones in case of sparse folio dirtying. This can thus result not only in extent leaf modifications but also in a need to allocate new extent tree nodes. As a result the reserved transaction credits were not sufficient in some corner cases. Use ext4_meta_trans_blocks() for correct upper bound credit estimate. Fixes:95ad8ee45c("ext4: correct the reserved credits for extent conversion") Signed-off-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20260805153605.166545-5-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
25b2a7e8d4
commit
46e8e31771
|
|
@ -2864,10 +2864,10 @@ static int ext4_do_writepages(struct mpage_da_data *mpd)
|
|||
if (ext4_should_dioread_nolock(inode)) {
|
||||
int bpf = ext4_journal_blocks_per_folio(inode);
|
||||
/*
|
||||
* We may need to convert up to one extent per block in
|
||||
* the folio and we may dirty the inode.
|
||||
* We may need to convert up to one extent per block in the
|
||||
* folio.
|
||||
*/
|
||||
rsv_blocks = 1 + ext4_ext_index_trans_blocks(inode, bpf);
|
||||
rsv_blocks = ext4_meta_trans_blocks(inode, bpf, bpf, 0);
|
||||
}
|
||||
|
||||
if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user