Whamcloud - gitweb
LU-13137 llite: do not flush COW pages from mapping 78/37278/17
authorBobi Jam <bobijam@whamcloud.com>
Tue, 21 Jan 2020 07:35:17 +0000 (15:35 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 14 May 2020 05:38:24 +0000 (05:38 +0000)
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 <bobijam@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/37278
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Stephan Thiell <sthiell@stanford.edu>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/llite_mmap.c
lustre/llite/vvp_object.c
lustre/tests/sanity-pcc.sh
lustre/tests/sanity.sh

index 0a943d3..60f32f4 100644 (file)
@@ -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);
index 01003a7..fdff422 100644 (file)
@@ -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;
index 09a40ff..093554a 100644 (file)
@@ -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
 
index 860e95f..c44f731 100755 (executable)
@@ -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"