From f519f22c8ba3a6de00af0bef77cae3b4b18acdab Mon Sep 17 00:00:00 2001 From: Alexander Boyko Date: Mon, 1 Jun 2020 08:38:07 -0400 Subject: [PATCH] LU-13617 tests: check client deadlock selinux 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 Cray-bug-id: LUS-8924 Change-Id: If7707fa14f7307fb3a3fb2228fbd1983b55cbe6b Reviewed-on: https://review.whamcloud.com/38793 Reviewed-by: Sebastien Buisson Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andrew Perepechko Reviewed-by: Oleg Drokin --- lustre/include/obd_support.h | 1 + lustre/llite/namei.c | 2 ++ lustre/tests/sanity-selinux.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 8fe1f5d..a3fb3c1 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -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 diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 0fd9d76..9b9c4b8 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -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); diff --git a/lustre/tests/sanity-selinux.sh b/lustre/tests/sanity-selinux.sh index 7d9ef93..0403a3c 100755 --- a/lustre/tests/sanity-selinux.sh +++ b/lustre/tests/sanity-selinux.sh @@ -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 -- 1.8.3.1