Commit b9f1b04
ext4: fix calculation of credits for extent tree modification
commit 32a93f5 upstream.
Luis and David are reporting that after running generic/750 test for 90+
hours on 2k ext4 filesystem, they are able to trigger a warning in
jbd2_journal_dirty_metadata() complaining that there are not enough
credits in the running transaction started in ext4_do_writepages().
Indeed the code in ext4_do_writepages() is racy and the extent tree can
change between the time we compute credits necessary for extent tree
computation and the time we actually modify the extent tree. Thus it may
happen that the number of credits actually needed is higher. Modify
ext4_ext_index_trans_blocks() to count with the worst case of maximum
tree depth. This can reduce the possible number of writers that can
operate in the system in parallel (because the credit estimates now won't
fit in one transaction) but for reasonably sized journals this shouldn't
really be an issue. So just go with a safe and simple fix.
Link: https://lore.kernel.org/all/20250415013641.f2ppw6wov4kn4wq2@offworld
Reported-by: Davidlohr Bueso <dave@stgolabs.net>
Reported-by: Luis Chamberlain <mcgrof@kernel.org>
Tested-by: kdevops@lists.linux.dev
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20250429175535.23125-2-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 796632e6f8298cad413f0b77f12a3f16333c2eda)1 parent 65b3cef commit b9f1b04
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2396 | 2396 | | |
2397 | 2397 | | |
2398 | 2398 | | |
2399 | | - | |
2400 | 2399 | | |
2401 | 2400 | | |
2402 | 2401 | | |
2403 | 2402 | | |
2404 | 2403 | | |
2405 | | - | |
2406 | | - | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
2407 | 2408 | | |
2408 | | - | |
| 2409 | + | |
2409 | 2410 | | |
2410 | | - | |
| 2411 | + | |
2411 | 2412 | | |
2412 | 2413 | | |
2413 | 2414 | | |
| |||
0 commit comments