Commit dbd468c6 authored by sunshijie's avatar sunshijie Committed by ting wang
Browse files

UPSTREAM: erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF



z_erofs_pcluster_readmore() may take a long time to loop when the page
offset is large enough, which is unnecessary should be prevented.

For example, when the following case is encountered, it will loop 4691368
times, taking about 27 seconds:
    - offset = 19217289215
    - inode_size = 1442672

Signed-off-by: default avatarChunhai Guo <guochunhai@vivo.com>
Fixes: 38629291 ("erofs: introduce readmore decompression strategy")
Reviewed-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: default avatarYue Hu <huyue2@coolpad.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20230710042531.28761-1-guochunhai@vivo.com


Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
(cherry picked from commit 936aa701
    https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git

 dev)
Bug: 296824280
Bug: 301017317
Bug: 301378679

Change-Id: I279b0fadcfa8c0ff0d638a86c7bb2c6b4d07f194
Signed-off-by: default avatarsunshijie <sunshijie@xiaomi.corp-partner.google.com>
Signed-off-by: default avatarsunshijie <sunshijie@xiaomi.com>
parent c7646ba9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment