diff options
author | Zhang Yi <yi.zhang@huawei.com> | 2023-08-24 17:26:04 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-11-28 17:20:15 +0000 |
commit | afe944f1f176e7059ce1a5ffe3f4d46ead6b3b87 (patch) | |
tree | 0e646af87afaaab44741fc558d6757ec502ac97f /fs | |
parent | 409e2d00c21fb73f2312cf64df6158400ec963dc (diff) | |
download | linux-stable-afe944f1f176e7059ce1a5ffe3f4d46ead6b3b87.tar.gz linux-stable-afe944f1f176e7059ce1a5ffe3f4d46ead6b3b87.tar.bz2 linux-stable-afe944f1f176e7059ce1a5ffe3f4d46ead6b3b87.zip |
ext4: correct the start block of counting reserved clusters
commit 40ea98396a3659062267d1fe5f99af4f7e4f05e3 upstream.
When big allocate feature is enabled, we need to count and update
reserved clusters before removing a delayed only extent_status entry.
{init|count|get}_rsvd() have already done this, but the start block
number of this counting isn't correct in the following case.
lblk end
| |
v v
-------------------------
| | orig_es
-------------------------
^ ^
len1 is 0 | len2 |
If the start block of the orig_es entry founded is bigger than lblk, we
passed lblk as start block to count_rsvd(), but the length is correct,
finally, the range to be counted is offset. This patch fix this by
passing the start blocks to 'orig_es->lblk + len1'.
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230824092619.1327976-2-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/extents_status.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index b9c8270e1cf0..f4b50652f0cc 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c @@ -1431,8 +1431,8 @@ static int __es_remove_extent(struct inode *inode, ext4_lblk_t lblk, } } if (count_reserved) - count_rsvd(inode, lblk, orig_es.es_len - len1 - len2, - &orig_es, &rc); + count_rsvd(inode, orig_es.es_lblk + len1, + orig_es.es_len - len1 - len2, &orig_es, &rc); goto out_get_reserved; } |