From: Bobi Jam Date: Tue, 21 Jan 2020 07:35:17 +0000 (+0800) Subject: LU-13137 llite: do not flush COW pages from mapping X-Git-Tag: 2.13.54~116 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=13a0066afb8d89b12653ff72f7311fd5e03ef6b4;p=fs%2Flustre-release.git LU-13137 llite: do not flush COW pages from mapping Do not flush COW pages from an executable mapping, as this will cause running binaries to segfault when mapped pages disappear under them. This was modified to allow non-blocking PCC caching, but triggers immediate segfaults for binaries when the DLM locks are revoked, even when PCC is not in use. The added test case failed 100% without this patch. This patch is only a partial fix to avoid the segfaults. There still needs to be something done to re-introduce the PCC functionality, but should be conditional on PCC enabled, and not for running binaries. There is a problem for PCC when multiple clients read/write on a shared mmapped file. We exclude mmap_sanity tst6 in test_4 from PCC testing temporarily. Test-Parameters: testlist=sanity envdefinitions=ONLY=30d Test-Parameters: testlist=sanity envdefinitions=ONLY=30d Test-Parameters: testlist=sanity envdefinitions=ONLY=30d Fixes: 58d744e3eaab ("LU-10092 pcc: Non-blocking PCC caching") Change-Id: I7084e1db1f0f29cb0237b619abd33ca556aa7ec7 Signed-off-by: Bobi Jam Reviewed-on: https://review.whamcloud.com/37278 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: Yingjin Qian Reviewed-by: Stephan Thiell Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 0a943d3..60f32f4 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -517,7 +517,7 @@ int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last) if (mapping_mapped(mapping)) { rc = 0; unmap_mapping_range(mapping, first + PAGE_SIZE - 1, - last - first + 1, 1); + last - first + 1, 0); } RETURN(rc); diff --git a/lustre/llite/vvp_object.c b/lustre/llite/vvp_object.c index 01003a7..fdff422 100644 --- a/lustre/llite/vvp_object.c +++ b/lustre/llite/vvp_object.c @@ -149,7 +149,7 @@ static int vvp_conf_set(const struct lu_env *env, struct cl_object *obj, * This operation is expensive but mmap processes have to pay * a price themselves. */ unmap_mapping_range(conf->coc_inode->i_mapping, - 0, OBD_OBJECT_EOF, 1); + 0, OBD_OBJECT_EOF, 0); pcc_layout_invalidate(conf->coc_inode); } return 0; diff --git a/lustre/tests/sanity-pcc.sh b/lustre/tests/sanity-pcc.sh index 09a40ff..093554a 100644 --- a/lustre/tests/sanity-pcc.sh +++ b/lustre/tests/sanity-pcc.sh @@ -697,7 +697,10 @@ test_4() { # mmap_sanity tst7 failed on the local ext4 filesystem. # It seems that Lustre filesystem does special process for tst 7. # Thus, we exclude tst7 from the PCC testing. - $LUSTRE/tests/mmap_sanity -d $DIR/$tdir -m $DIR2/$tdir -e 7 || + # There is a mmap problem for PCC when multiple clients read/write + # on a shared mmapped file. Thus, we exclude mmap_sanity tst6 from + # the PCC tesing. + $LUSTRE/tests/mmap_sanity -d $DIR/$tdir -m $DIR2/$tdir -e 6 -e 7 || error "mmap_sanity test failed" sync; sleep 1; sync diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 860e95f..c44f731 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3075,7 +3075,7 @@ run_test 30b "execute binary from Lustre as non-root ===========" test_30c() { # b=22376 [ $PARALLEL == "yes" ] && skip "skip parallel run" - cp `which ls` $DIR || cp /bin/ls $DIR + cp $(which ls) $DIR || cp /bin/ls $DIR chmod a-rw $DIR/ls cancel_lru_locks mdc cancel_lru_locks osc @@ -3084,6 +3084,22 @@ test_30c() { # b=22376 } run_test 30c "execute binary from Lustre without read perms ====" +test_30d() { + cp $(which dd) $DIR || error "failed to copy dd to $DIR/dd" + + for i in {1..10}; do + $DIR/dd bs=1M count=128 if=/dev/zero of=$DIR/$tfile & + local PID=$! + sleep 1 + $LCTL set_param ldlm.namespaces.*MDT*.lru_size=clear + wait $PID || error "executing dd from Lustre failed" + rm -f $DIR/$tfile + done + + rm -f $DIR/dd +} +run_test 30d "execute binary from Lustre while clear locks" + test_31a() { $OPENUNLINK $DIR/f31 $DIR/f31 || error "openunlink failed" $CHECKSTAT -a $DIR/f31 || error "$DIR/f31 exists"