]> git.itanic.dy.fi Git - linux-stable/commit
ext4: set goal start correctly in ext4_mb_normalize_request
authorKemeng Shi <shikemeng@huaweicloud.com>
Fri, 3 Mar 2023 17:21:01 +0000 (01:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 May 2023 11:38:35 +0000 (12:38 +0100)
commit2479bb6cbdb4d56b807bbe5229e3e26a6f1f4530
treeb3e6b10e49d498414ccaf8fb8d19ec034d1a944e
parent12b32076a56e75de619b8272954c0f22c28fbf30
ext4: set goal start correctly in ext4_mb_normalize_request

[ Upstream commit b07ffe6927c75d99af534d685282ea188d9f71a6 ]

We need to set ac_g_ex to notify the goal start used in
ext4_mb_find_by_goal. Set ac_g_ex instead of ac_f_ex in
ext4_mb_normalize_request.
Besides we should assure goal start is in range [first_data_block,
blocks_count) as ext4_mb_initialize_context does.

[ Added a check to make sure size is less than ar->pright; otherwise
  we could end up passing an underflowed value of ar->pright - size to
  ext4_get_group_no_and_offset(), which will trigger a BUG_ON later on.
  - TYT ]

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20230303172120.3800725-2-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/mballoc.c