From: Zizhi Wo wozizhi@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT
--------------------------------
When erofs performs readahead will execute erofs_fscache_readahead(), which will execute fscache_prepare_read() first, then execute readahead_page(), that may lead to BUG_ON as it may unlock_page first. Fix this problem by only update rac but not check the page lock as the erofs readahead is not rely on page.
Signed-off-by: Zizhi Wo wozizhi@huawei.com Signed-off-by: Baokun Li libaokun1@huawei.com --- fs/erofs/fscache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index 36bb49ecf6a2..12b0c564b7c3 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -255,10 +255,9 @@ static void erofs_fscache_readahead(struct readahead_control *rac) }
done += count; - while (count) { - page = readahead_page(rac); - count -= PAGE_SIZE; - } + count /= PAGE_SIZE; + rac->_nr_pages -= count; + rac->_index += count; } while (done < len); }