提交 2105af3b 编写于 作者: B Baokun Li 提交者: Yongqiang Liu

ext4: correct the judgment of BUG in ext4_mb_normalize_request

hulk inclusion
category: bugfix
bugzilla: 186777, https://gitee.com/openeuler/kernel/issues/I5C568
CVE: NA

--------------------------------

ext4_mb_normalize_request() can move logical start of allocated blocks
to reduce fragmentation and better utilize preallocation. However logical
block requested as a start of allocation (ac->ac_o_ex.fe_logical) should
always be covered by allocated blocks so we should check that by
modifying and to or in the assertion.
Signed-off-by: NBaokun Li <libaokun1@huawei.com>
Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 74e77e63
......@@ -3253,7 +3253,22 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
}
rcu_read_unlock();
if (start + size <= ac->ac_o_ex.fe_logical &&
/*
* In this function "start" and "size" are normalized for better
* alignment and length such that we could preallocate more blocks.
* This normalization is done such that original request of
* ac->ac_o_ex.fe_logical & fe_len should always lie within "start" and
* "size" boundaries.
* (Note fe_len can be relaxed since FS block allocation API does not
* provide gurantee on number of contiguous blocks allocation since that
* depends upon free space left, etc).
* In case of inode pa, later we use the allocated blocks
* [pa_start + fe_logical - pa_lstart, fe_len/size] from the preallocated
* range of goal/best blocks [start, size] to put it at the
* ac_o_ex.fe_logical extent of this inode.
* (See ext4_mb_use_inode_pa() for more details)
*/
if (start + size <= ac->ac_o_ex.fe_logical ||
start > ac->ac_o_ex.fe_logical) {
ext4_msg(ac->ac_sb, KERN_ERR,
"start %lu, size %lu, fe_logical %lu",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册