Whamcloud - gitweb
LU-16210 llite: replace selinux_is_enabled()
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 900de19..cbe3909 100755 (executable)
@@ -27622,6 +27622,41 @@ test_433() {
 }
 run_test 433 "ldlm lock cancel releases dentries and inodes"
 
+test_434() {
+       local file
+       local getxattr_count
+       local mdc_stat_param="mdc.$FSNAME-MDT0000*.md_stats"
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+
+       [[ $(getenforce) == "Disabled" ]] ||
+               skip "lsm selinux module have to be disabled for this test"
+
+       test_mkdir -i 0 -c1 $DIR/$tdir/ ||
+               error "fail to create $DIR/$tdir/ on MDT0000"
+
+       touch $DIR/$tdir/$tfile-{001..100}
+
+       # disable the xattr cache
+       save_lustre_params client "llite.*.xattr_cache" > $p
+       lctl set_param llite.*.xattr_cache=0
+       stack_trap "restore_lustre_params < $p; rm -f $p" EXIT
+
+       # clear clients mdc stats
+       clear_stats $mdc_stat_param ||
+               error "fail to clear stats on mdc MDT0000"
+
+       for file in $DIR/$tdir/$tfile-{001..100}; do
+               getfattr -n security.selinux $file |&
+                       grep -q "Operation not supported" ||
+                       error "getxattr on security.selinux should return EOPNOTSUPP"
+       done
+
+       getxattr_count=$(calc_stats $mdc_stat_param "getxattr")
+       (( getxattr_count < 100 )) ||
+               error "client sent $getxattr_count getxattr RPCs to the MDS"
+}
+run_test 434 "Client should not send RPCs for security.selinux with SElinux disabled"
+
 prep_801() {
        [[ $MDS1_VERSION -lt $(version_code 2.9.55) ]] ||
        [[ $OST1_VERSION -lt $(version_code 2.9.55) ]] &&