diff options
author | Gao Xiang | 2023-08-31 19:29:58 +0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-09-06 21:26:59 +0100 |
commit | 1ce9ebc96eda5556e5a15bbe6a17b293841af29e (patch) | |
tree | e2c0414c10ff32a23e75052844e066acd2a224f5 /fs | |
parent | c2cbfe5f51227dfe6ef7be013f0d56a32c040faa (diff) |
erofs: ensure that the post-EOF tails are all zeroed
commit e4c1cf523d820730a86cae2c6d55924833b6f7ac upstream.
This was accidentally fixed up in commit e4c1cf523d82 but we can't
take the full change due to other dependancy issues, so here is just
the actual bugfix that is needed.
[Background]
keltargw reported an issue [1] that with mmaped I/Os, sometimes the
tail of the last page (after file ends) is not filled with zeroes.
The root cause is that such tail page could be wrongly selected for
inplace I/Os so the zeroed part will then be filled with compressed
data instead of zeroes.
A simple fix is to avoid doing inplace I/Os for such tail parts,
actually that was already fixed upstream in commit e4c1cf523d82
("erofs: tidy up z_erofs_do_read_page()") by accident.
[1] https://lore.kernel.org/r/3ad8b469-25db-a297-21f9-75db2d6ad224@linux.alibaba.com
Reported-by: keltargw <keltar.gw@gmail.com>
Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/erofs/zdata.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 361f3c29897e..1b91ac5be961 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -869,6 +869,8 @@ hitted: cur = end - min_t(erofs_off_t, offset + end - map->m_la, end); if (!(map->m_flags & EROFS_MAP_MAPPED)) { zero_user_segment(page, cur, end); + ++spiltted; + tight = false; goto next_part; } if (map->m_flags & EROFS_MAP_FRAGMENT) { |