linux/drivers/staging/erofs
Gao Xiang a112152f6f staging: erofs: fix mis-acted TAIL merging behavior
EROFS has an optimized path called TAIL merging, which is designed
to merge multiple reads and the corresponding decompressions into
one if these requests read continuous pages almost at the same time.

In general, it behaves as follows:
 ________________________________________________________________
  ... |  TAIL  .  HEAD  |  PAGE  |  PAGE  |  TAIL    . HEAD | ...
 _____|_combined page A_|________|________|_combined page B_|____
        1  ]  ->  [  2                          ]  ->  [ 3
If the above three reads are requested in the order 1-2-3, it will
generate a large work chain rather than 3 individual work chains
to reduce scheduling overhead and boost up sequential read.

However, if Read 2 is processed slightly earlier than Read 1,
currently it still generates 2 individual work chains (chain 1, 2)
but it does in-place decompression for combined page A, moreover,
if chain 2 decompresses ahead of chain 1, it will be a race and
lead to corrupted decompressed page. This patch fixes it.

Fixes: 3883a79abd ("staging: erofs: introduce VLE decompression support")
Cc: <stable@vger.kernel.org> # 4.19+
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-27 15:41:57 +01:00
..
Documentation/filesystems staging: erofs: complete POSIX ACL support 2019-01-30 15:38:50 +01:00
include staging: erofs: add trace points for reading zipped data 2018-09-18 16:35:03 +02:00
data.c staging: erofs: clean up erofs_map_blocks_iter 2019-01-15 15:52:26 +01:00
dir.c staging: erofs: switch to ->iterate_shared() 2019-02-26 11:52:46 +01:00
erofs_fs.h staging: erofs: remove __EROFS_BIT 2018-12-12 11:29:46 +01:00
inode.c staging: erofs: complete POSIX ACL support 2019-01-30 15:38:50 +01:00
internal.h staging: erofs: fix race of initializing xattrs of a inode at the same time 2019-02-20 11:20:55 +01:00
Kconfig staging: erofs: fix undefined LZ4_decompress_safe_partial() 2018-11-09 08:34:39 -08:00
Makefile staging: prefix header search paths with $(srctree)/ 2019-02-04 12:30:27 +01:00
namei.c staging: erofs: keep corrupted fs from crashing kernel in erofs_namei() 2019-02-14 10:47:21 +01:00
super.c staging: erofs: complete POSIX ACL support 2019-01-30 15:38:50 +01:00
TODO staging: erofs: update erofs-utils information in TODO 2018-12-06 16:08:56 +01:00
unzip_pagevec.h staging: erofs: unzip_{pagevec.h,vle.c}: rectify BUG_ONs 2018-12-12 10:56:34 +01:00
unzip_vle_lz4.c staging: erofs: compressed_pages should not be accessed again after freed 2019-02-27 15:41:57 +01:00
unzip_vle.c staging: erofs: fix mis-acted TAIL merging behavior 2019-02-27 15:41:57 +01:00
unzip_vle.h staging: erofs: compressed_pages should not be accessed again after freed 2019-02-27 15:41:57 +01:00
utils.c staging: erofs: staticize erofs_shrink_count, erofs_shrink_scan 2019-01-18 10:37:16 +01:00
xattr.c staging: erofs: fix race of initializing xattrs of a inode at the same time 2019-02-20 11:20:55 +01:00
xattr.h staging: erofs: complete POSIX ACL support 2019-01-30 15:38:50 +01:00