Whamcloud - gitweb
LU-13617 tests: check client deadlock selinux 93/38793/4
authorAlexander Boyko <c17825@cray.com>
Mon, 1 Jun 2020 12:38:07 +0000 (08:38 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 13 Aug 2020 05:59:16 +0000 (05:59 +0000)
The patch adds test_20e to sanity-selinux. It checks client deadlock
and MDS eviction for it.

Test-Parameters: trivial testlist=sanity-selinux env=ONLY=20e
Signed-off-by: Alexander Boyko <alexander.boyko@hpe.com>
Cray-bug-id: LUS-8924
Change-Id: If7707fa14f7307fb3a3fb2228fbd1983b55cbe6b
Reviewed-on: https://review.whamcloud.com/38793
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_support.h
lustre/llite/namei.c
lustre/tests/sanity-selinux.sh

index 8fe1f5d..a3fb3c1 100644 (file)
@@ -583,6 +583,7 @@ extern char obd_jobid_var[];
 #define OBD_FAIL_LLITE_PCC_MKWRITE_PAUSE           0x1413
 #define OBD_FAIL_LLITE_PCC_ATTACH_PAUSE                    0x1414
 #define OBD_FAIL_LLITE_SHORT_COMMIT                0x1415
+#define OBD_FAIL_LLITE_CREATE_FILE_PAUSE2          0x1416
 
 #define OBD_FAIL_FID_INDIR     0x1501
 #define OBD_FAIL_FID_INLMA     0x1502
index 0fd9d76..9b9c4b8 100644 (file)
@@ -1116,6 +1116,8 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry,
                rc = 0;
        }
 
+       OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE2, cfs_fail_val);
+
        /* Dentry added to dcache tree in ll_lookup_it */
        de = ll_lookup_it(dir, dentry, it, &secctx, &secctxlen, &pca, encrypt,
                          &encctx, &encctxlen);
index 7d9ef93..0403a3c 100755 (executable)
@@ -468,6 +468,36 @@ test_20d() {
 }
 run_test 20d "[atomicity] avoid getxattr for security context"
 
+test_20e() {
+       [ "$CLIENT_VERSION" -lt $(version_code 2.13.54) ] &&
+               skip "Need client version >= 2.13.54"
+       local filename1=$DIR/$tdir/df20e
+       local delay=5
+       local evict
+       local unconctx="-u unconfined_u -r unconfined_r -t unconfined_t -l s0"
+
+       mkdir -p $DIR/$tdir
+       chmod 777 $DIR/$tdir
+       #define OBD_FAIL_LLITE_CREATE_FILE_PAUSE2   0x1416
+       do_facet client "$LCTL set_param fail_val=$delay fail_loc=0x80001416"
+
+       # create file on first mount point
+       $RUNAS_CMD -u $RUNAS_ID runcon $unconctx touch $filename1 &
+       local touchpid=$!
+       sleep 1
+       cancel_lru_locks mdc
+       sysctl -w vm.drop_caches=2
+       $RUNAS_CMD -u $RUNAS_ID runcon $unconctx stat $DIR/$tdir &
+
+       wait $touchpid
+
+       evict=$($LCTL get_param mdc.$FSNAME-MDT*.state |
+         awk -F"[ [,]" '/EVICTED ]$/ { if (mx<$5) {mx=$5;} } END { print mx }')
+
+       [ -z "$evict" ] || [[ $evict -le $before ]] || error "eviction happened"
+}
+run_test 20e "client deadlock and eviction form MDS"
+
 check_nodemap() {
        local nm=$1
        local key=$2