Whamcloud - gitweb
LU-15282 tests: relax test_51d thresholds somewhat
[fs/lustre-release.git] / lustre / tests / sanity.sh
index b906786..880259a 100755 (executable)
@@ -5892,7 +5892,7 @@ test_51d_sub() {
 
        local nlast
        local min=4
-       local max=5 # allow variance of (1 - $min/$max) = 20% by default
+       local max=6 # allow variance of (1 - $min/$max) = 33% by default
 
        # For some combinations of stripecount and OSTCOUNT current code
        # is not ideal, and allocates 50% fewer *first* objects to some OSTs
@@ -18807,18 +18807,32 @@ test_205b() {
        (( $MDS1_VERSION >= $(version_code 2.13.54.91) )) ||
                skip "Need MDS version at least 2.13.54.91"
 
-       job_stats="mdt.*.job_stats"
-       $LCTL set_param $job_stats=clear
+       local job_stats="mdt.*.job_stats"
+       local old_jobid=$(do_facet mds1 $LCTL get_param jobid_var)
+
+       do_facet mds1 $LCTL set_param $job_stats=clear
+
        # Setting jobid_var to USER might not be supported
+       [[ -n "$old_jobid" ]] && stack_trap "$LCTL set_param $old_jobid"
        $LCTL set_param jobid_var=USER || true
-       $LCTL set_param jobid_name="%e.%u"
+       stack_trap "$LCTL set_param $($LCTL get_param jobid_name)"
+       $LCTL set_param jobid_name="%j.%e.%u"
+
        env -i USERTESTJOBSTATS=foolish touch $DIR/$tfile.1
-       do_facet $SINGLEMDS $LCTL get_param $job_stats |
-               grep "job_id:.*foolish" &&
-                       error "Unexpected jobid found"
-       do_facet $SINGLEMDS $LCTL get_param $job_stats |
-               grep "open:.*min.*max.*sum" ||
-                       error "wrong job_stats format found"
+       do_facet mds1 $LCTL get_param $job_stats | grep "job_id:.*foolish" &&
+               { do_facet mds1 $LCTL get_param $job_stats;
+                 error "Unexpected jobid found"; }
+       do_facet mds1 $LCTL get_param $job_stats | grep "open:.*min.*max.*sum"||
+               { do_facet mds1 $LCTL get_param $job_stats;
+                 error "wrong job_stats format found"; }
+
+       (( $MDS1_VERSION <= $(version_code 2.15.0) )) &&
+               echo "MDS does not yet escape jobid" && return 0
+       $LCTL set_param jobid_var=TEST205b
+       env -i TEST205b="has sp" touch $DIR/$tfile.2
+       do_facet mds1 $LCTL get_param $job_stats | grep "has.*x20sp" ||
+               { do_facet mds1 $LCTL get_param $job_stats;
+                 error "jobid not escaped"; }
 }
 run_test 205b "Verify job stats jobid and output format"
 
@@ -28578,6 +28592,27 @@ test_904() {
 }
 run_test 904 "virtual project ID xattr"
 
+# LU-8582
+test_905() {
+       (( $OST1_VERSION >= $(version_code 2.8.54) )) ||
+               skip "lustre < 2.8.54 does not support ladvise"
+
+       remote_ost_nodsh && skip "remote OST with nodsh"
+       $LFS setstripe -c -1 -i 0 $DIR/$tfile || error "setstripe failed"
+
+       $LFS ladvise -a willread $DIR/$tfile || error "ladvise does not work"
+
+       #define OBD_FAIL_OST_OPCODE 0x253
+       # OST_LADVISE = 21
+       do_facet ost1 "$LCTL set_param fail_val=21 fail_loc=0x0253"
+       $LFS ladvise -a willread $DIR/$tfile &&
+               error "unexpected success of ladvise with fault injection"
+       $LFS ladvise -a willread $DIR/$tfile |&
+               grep -q "Operation not supported"
+       (( $? == 0 )) || error "unexpected stderr of ladvise with fault injection"
+}
+run_test 905 "bad or new opcode should not stuck client"
+
 complete $SECONDS
 [ -f $EXT2_DEV ] && rm $EXT2_DEV || true
 check_and_cleanup_lustre