+test_401a() { #LU-7437
+ #count the number of parameters by "list_param -R"
+ local params=$($LCTL list_param -R '*' 2>/dev/null | wc -l)
+ #count the number of parameters by listing proc files
+ local procs=$(find -L $proc_dirs -mindepth 1 -printf '%P\n' 2>/dev/null|
+ sort -u | wc -l)
+
+ [ $params -eq $procs ] ||
+ error "found $params parameters vs. $procs proc files"
+
+ # test the list_param -D option only returns directories
+ params=$($LCTL list_param -R -D '*' 2>/dev/null | wc -l)
+ #count the number of parameters by listing proc directories
+ procs=$(find -L $proc_dirs -mindepth 1 -type d -printf '%P\n' 2>/dev/null |
+ sort -u | wc -l)
+
+ [ $params -eq $procs ] ||
+ error "found $params parameters vs. $procs proc files"
+}
+run_test 401a "Verify if 'lctl list_param -R' can list parameters recursively"
+
+test_401b() {
+ local save=$($LCTL get_param -n jobid_var)
+ local tmp=testing
+
+ $LCTL set_param foo=bar jobid_var=$tmp bar=baz &&
+ error "no error returned when setting bad parameters"
+
+ local jobid_new=$($LCTL get_param -n foe jobid_var baz)
+ [[ "$jobid_new" == "$tmp" ]] || error "jobid tmp $jobid_new != $tmp"
+
+ $LCTL set_param -n fog=bam jobid_var=$save bat=fog
+ local jobid_old=$($LCTL get_param -n foe jobid_var bag)
+ [[ "$jobid_old" == "$save" ]] || error "jobid new $jobid_old != $save"
+}
+run_test 401b "Verify 'lctl {get,set}_param' continue after error"
+
+test_401c() {
+ local jobid_var_old=$($LCTL get_param -n jobid_var)
+ local jobid_var_new
+
+ $LCTL set_param jobid_var= &&
+ error "no error returned for 'set_param a='"
+
+ jobid_var_new=$($LCTL get_param -n jobid_var)
+ [[ "$jobid_var_old" == "$jobid_var_new" ]] ||
+ error "jobid_var was changed by setting without value"
+
+ $LCTL set_param jobid_var &&
+ error "no error returned for 'set_param a'"
+
+ jobid_var_new=$($LCTL get_param -n jobid_var)
+ [[ "$jobid_var_old" == "$jobid_var_new" ]] ||
+ error "jobid_var was changed by setting without value"
+}
+run_test 401c "Verify 'lctl set_param' without value fails in either format."
+
+test_401d() {
+ local jobid_var_old=$($LCTL get_param -n jobid_var)
+ local jobid_var_new
+ local new_value="foo=bar"
+
+ $LCTL set_param jobid_var=$new_value ||
+ error "'set_param a=b' did not accept a value containing '='"
+
+ jobid_var_new=$($LCTL get_param -n jobid_var)
+ [[ "$jobid_var_new" == "$new_value" ]] ||
+ error "'set_param a=b' failed on a value containing '='"
+
+ # Reset the jobid_var to test the other format
+ $LCTL set_param jobid_var=$jobid_var_old
+ jobid_var_new=$($LCTL get_param -n jobid_var)
+ [[ "$jobid_var_new" == "$jobid_var_old" ]] ||
+ error "failed to reset jobid_var"
+
+ $LCTL set_param jobid_var $new_value ||
+ error "'set_param a b' did not accept a value containing '='"
+
+ jobid_var_new=$($LCTL get_param -n jobid_var)
+ [[ "$jobid_var_new" == "$new_value" ]] ||
+ error "'set_param a b' failed on a value containing '='"
+
+ $LCTL set_param jobid_var $jobid_var_old
+ jobid_var_new=$($LCTL get_param -n jobid_var)
+ [[ "$jobid_var_new" == "$jobid_var_old" ]] ||
+ error "failed to reset jobid_var"
+}
+run_test 401d "Verify 'lctl set_param' accepts values containing '='"
+
+test_402() {
+ $LFS setdirstripe -i 0 $DIR/$tdir || error "setdirstripe -i 0 failed"
+#define OBD_FAIL_MDS_FLD_LOOKUP 0x15c
+ do_facet mds1 "lctl set_param fail_loc=0x8000015c"
+ touch $DIR/$tdir/$tfile && error "touch should fail with ENOENT" ||
+ echo "Touch failed - OK"
+}
+run_test 402 "Return ENOENT to lod_generate_and_set_lovea"
+
+test_403() {
+ local file1=$DIR/$tfile.1
+ local file2=$DIR/$tfile.2
+ local tfile=$TMP/$tfile
+
+ rm -f $file1 $file2 $tfile
+
+ touch $file1
+ ln $file1 $file2
+
+ # 30 sec OBD_TIMEOUT in ll_getattr()
+ # right before populating st_nlink
+ $LCTL set_param fail_loc=0x80001409
+ stat -c %h $file1 > $tfile &
+
+ # create an alias, drop all locks and reclaim the dentry
+ < $file2
+ cancel_lru_locks mdc
+ cancel_lru_locks osc
+ sysctl -w vm.drop_caches=2
+
+ wait
+
+ [ `cat $tfile` -gt 0 ] || error "wrong nlink count: `cat $tfile`"
+
+ rm -f $tfile $file1 $file2
+}
+run_test 403 "i_nlink should not drop to zero due to aliasing"
+
+test_404() { # LU-6601
+ local mosps=$(do_facet $SINGLEMDS $LCTL dl |
+ awk '/osp .*-osc-MDT/ { print $4}')
+
+ local osp
+ for osp in $mosps; do
+ echo "Deactivate: " $osp
+ do_facet $SINGLEMDS $LCTL --device %$osp deactivate
+ local stat=$(do_facet $SINGLEMDS $LCTL dl |
+ awk -vp=$osp '$4 == p { print $2 }')
+ [ $stat = IN ] || {
+ do_facet $SINGLEMDS $LCTL dl | grep -w $osp
+ error "deactivate error"
+ }
+ echo "Activate: " $osp
+ do_facet $SINGLEMDS $LCTL --device %$osp activate
+ local stat=$(do_facet $SINGLEMDS $LCTL dl |
+ awk -vp=$osp '$4 == p { print $2 }')
+ [ $stat = UP ] || {
+ do_facet $SINGLEMDS $LCTL dl | grep -w $osp
+ error "activate error"
+ }
+ done
+}
+run_test 404 "validate manual {de}activated works properly for OSPs"
+