Whamcloud - gitweb
LU-14003 pcc: rework PCC mmap implementation
authorQian Yingjin <qian@ddn.com>
Wed, 30 Sep 2020 03:00:43 +0000 (11:00 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 25 Mar 2021 14:16:15 +0000 (14:16 +0000)
commita030b7c9f561ac86c91ac96389f7d389f75408cb
tree325098055dfbfb03177379aeb9ebf2646f61538f
parent14d3d703f4ac195efc26944acf8faec96861456a
LU-14003 pcc: rework PCC mmap implementation

In the old PCC mmap implementation, it replaces the vm_file with
the file of the PCC copy, and then call ->fault() or
->page_mkwrite() on the PCC copy, after that restore the vm_file
with the one of the Lustre file.
This design exists problem as a mmaped region (vma) could be
faulted concurrently with multiple children threads (each children
threads can clone the VM of the parent process). There is no any
atomic guarantee for the replacement and restore the vm_file during
calling ->fault() or ->page_mkwrite().

This patch reworks the mmap() implementation for PCC.
In the new design, PCC mmap replaces the inode mapping of the PCC
copy on the PCC backend filesystem with the one of the Lustre file.
By this way, the mmaped region (vma) will link into the mapping of
the Lustre inode not the mapping of the PCC copy.
It keeps using vm_file with the file handle of the PCC copy until
the PCC cached file is detached or unmmaped.

Test-Parameters: clientcount=3 testlist=sanity-pcc,sanity-pcc,sanity-pcc
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: Icc5019a691dfb04b5e1fdd580d83915cfe590158
Reviewed-on: https://review.whamcloud.com/41923
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/llite_mmap.c
lustre/llite/pcc.c
lustre/llite/pcc.h
lustre/llite/vvp_io.c
lustre/llite/vvp_object.c
lustre/tests/Makefile.am
lustre/tests/mmap_sanity.c
lustre/tests/sanity-pcc.sh