diff options
| author | Zhang Yi <[email protected]> | 2025-07-07 14:08:13 +0000 |
|---|---|---|
| committer | Theodore Ts'o <[email protected]> | 2025-07-14 03:41:52 +0000 |
| commit | 5137d6c8906b55b3c7b5d1aa5a549753ec8520f5 (patch) | |
| tree | 8bc02907ad4db6bd2f805647ff9063cede2445ca | |
| parent | ext4: replace ext4_writepage_trans_blocks() (diff) | |
| download | kernel-5137d6c8906b55b3c7b5d1aa5a549753ec8520f5.tar.gz kernel-5137d6c8906b55b3c7b5d1aa5a549753ec8520f5.zip | |
ext4: fix insufficient credits calculation in ext4_meta_trans_blocks()
The calculation of journal credits in ext4_meta_trans_blocks() should
include pextents, as each extent separately may be allocated from a
different group and thus need to update different bitmap and group
descriptor block.
Fixes: 0e32d8617012 ("ext4: correct the journal credits calculations of allocating blocks")
Reported-by: Jan Kara <[email protected]>
Closes: https://lore.kernel.org/linux-ext4/nhxfuu53wyacsrq7xqgxvgzcggyscu2tbabginahcygvmc45hy@t4fvmyeky33e/
Signed-off-by: Zhang Yi <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Reviewed-by: Baokun Li <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Theodore Ts'o <[email protected]>
| -rw-r--r-- | fs/ext4/inode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 13b25f41c134..4a0ba009c88e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -6212,7 +6212,7 @@ int ext4_meta_trans_blocks(struct inode *inode, int lblocks, int pextents) int ret; /* - * How many index and lead blocks need to touch to map @lblocks + * How many index and leaf blocks need to touch to map @lblocks * logical blocks to @pextents physical extents? */ idxblocks = ext4_index_trans_blocks(inode, lblocks, pextents); @@ -6221,7 +6221,7 @@ int ext4_meta_trans_blocks(struct inode *inode, int lblocks, int pextents) * Now let's see how many group bitmaps and group descriptors need * to account */ - groups = idxblocks; + groups = idxblocks + pextents; gdpblocks = groups; if (groups > ngroups) groups = ngroups; |
