summaryrefslogtreecommitdiffstats
path: root/fs/erofs/zdata.c
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@linux.alibaba.com>2022-10-12 06:50:56 +0200
committerGao Xiang <hsiangkao@linux.alibaba.com>2022-10-17 00:55:49 +0200
commit63bbb85658ea43dd35dbfde6d4150b47c407fc87 (patch)
treef4aa82707c133c0dd5101eb2086ea57efae0e16f /fs/erofs/zdata.c
parenterofs: fix illegal unmapped accesses in z_erofs_fill_inode_lazy() (diff)
downloadlinux-63bbb85658ea43dd35dbfde6d4150b47c407fc87.tar.xz
linux-63bbb85658ea43dd35dbfde6d4150b47c407fc87.zip
erofs: shouldn't churn the mapping page for duplicated copies
If other duplicated copies exist in one decompression shot, should leave the old page as is rather than replace it with the new duplicated one. Otherwise, the following cold path to deal with duplicated copies will use the invalid bvec. It impacts compressed data deduplication. Also, shift the onlinepage EIO bit to avoid touching the signed bit. Fixes: 267f2492c8f7 ("erofs: introduce multi-reference pclusters (fully-referenced)") Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://lore.kernel.org/r/20221012045056.13421-1-hsiangkao@linux.alibaba.com
Diffstat (limited to 'fs/erofs/zdata.c')
-rw-r--r--fs/erofs/zdata.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 559380a535af..4553be650968 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -888,15 +888,13 @@ static void z_erofs_do_decompressed_bvec(struct z_erofs_decompress_backend *be,
if (!((bvec->offset + be->pcl->pageofs_out) & ~PAGE_MASK)) {
unsigned int pgnr;
- struct page *oldpage;
pgnr = (bvec->offset + be->pcl->pageofs_out) >> PAGE_SHIFT;
DBG_BUGON(pgnr >= be->nr_pages);
- oldpage = be->decompressed_pages[pgnr];
- be->decompressed_pages[pgnr] = bvec->page;
-
- if (!oldpage)
+ if (!be->decompressed_pages[pgnr]) {
+ be->decompressed_pages[pgnr] = bvec->page;
return;
+ }
}
/* (cold path) one pcluster is requested multiple times */