+ for ((i = 0; i < $n; i++)); do
+ do_nodes $CLIENTS $myRUNAS dd if=/dev/zero \
+ of="$dir/nrs_w_$HOSTNAME" bs=1M seek=$i count=1 ||
+ error "dd at ${i}MB on client failed (2)" &
+ local pids_w[$i]=$!
+ done
+ do_nodes $CLIENTS sync;
+ cancel_lru_locks osc
+
+ for ((i = 0; i < $n; i++)); do
+ do_nodes $CLIENTS $myRUNAS dd if="$dir/nrs_w_$HOSTNAME" \
+ of=/dev/zero bs=1M seek=$i count=1 > /dev/null ||
+ error "dd at ${i}MB on client failed (3)" &
+ local pids_r[$i]=$!
+ done
+ cancel_lru_locks osc
+
+ for ((i = 0; i < $n; i++)); do
+ wait ${pids_w[$i]}
+ wait ${pids_r[$i]}
+ done
+ rm -rf $dir || error "rm -rf $dir failed"
+}
+
+test_77a() { #LU-3266
+ local rc
+
+ oss=$(comma_list $(osts_nodes))
+ do_nodes $oss lctl set_param ost.OSS.*.nrs_policies="fifo" ||
+ rc=$?
+ [[ $rc -eq 3 ]] && skip "no NRS exists" && return
+ [[ $rc -ne 0 ]] && error "failed to set fifo policy"
+ nrs_write_read
+
+ return 0
+}
+run_test 77a "check FIFO NRS policy"
+
+test_77b() { #LU-3266
+ local rc
+
+ oss=$(comma_list $(osts_nodes))
+
+ do_nodes $oss lctl set_param ost.OSS.*.nrs_policies="crrn" \
+ ost.OSS.*.nrs_crrn_quantum=1 || rc=$?
+ [[ $rc -eq 3 ]] && skip "no NRS exists" && return
+ [[ $rc -ne 0 ]] && error "failed to set crrn_quantum to 1"
+
+ echo "policy: crr-n, crrn_quantum 1"
+ nrs_write_read
+
+ do_nodes $oss lctl set_param \
+ ost.OSS.*.nrs_crrn_quantum=64 || rc=$?
+ [[ $rc -ne 0 ]] && error "failed to set crrn_quantum to 64"
+
+ echo "policy: crr-n, crrn_quantum 64"
+ nrs_write_read
+
+ # cleanup
+ do_nodes $oss lctl set_param \
+ ost.OSS.ost_io.nrs_policies="fifo" || rc=$?
+ [[ $rc -ne 0 ]] && error "failed to set fifo policy"
+ return 0
+}
+run_test 77b "check CRR-N NRS policy"
+
+orr_trr() {
+ local policy=$1
+
+ oss=$(comma_list $(osts_nodes))
+
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies=$policy \
+ ost.OSS.*.nrs_"$policy"_quantum=1 \
+ ost.OSS.*.nrs_"$policy"_offset_type="physical" \
+ ost.OSS.*.nrs_"$policy"_supported="reads" || return $?
+
+ echo "policy: $policy, ${policy}_quantum 1, ${policy}_offset_type " \
+ "physical, ${policy}_supported reads"
+ nrs_write_read
+
+ do_nodes $oss lctl set_param \
+ ost.OSS.*.nrs_${policy}_supported="writes" \
+ ost.OSS.*.nrs_${policy}_quantum=64 || return $?
+
+ echo "policy: $policy, ${policy}_quantum 64, ${policy}_offset_type " \
+ "physical, ${policy}_supported writes"
+ nrs_write_read
+
+ do_nodes $oss lctl set_param \
+ ost.OSS.*.nrs_${policy}_supported="reads_and_writes" \
+ ost.OSS.*.nrs_${policy}_offset_type="logical" || return $?
+ echo "policy: $policy, ${policy}_quantum 64, ${policy}_offset_type " \
+ "logical, ${policy}_supported reads_and_writes"
+ nrs_write_read
+
+ # cleanup
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo" ||
+ return $?
+ return 0
+}
+
+test_77c() { #LU-3266
+ local rc
+ orr_trr "orr" || rc=$?
+ [[ $rc -eq 3 ]] && skip "no NRS exists" && return
+ [[ $rc -ne 0 ]] && error "orr_trr failed rc:$rc"
+ return 0
+}
+run_test 77c "check ORR NRS policy"
+
+test_77d() { #LU-3266
+ local rc
+ orr_trr "trr" || rc=$?
+ [[ $rc -eq 3 ]] && skip "no NRS exists" && return
+ [[ $rc -ne 0 ]] && error "orr_trr failed rc:$rc"
+ return 0
+}
+run_test 77d "check TRR nrs policy"
+
+tbf_rule_operate()
+{
+ local facet=$1
+ shift 1
+
+ do_facet $facet lctl set_param \
+ ost.OSS.ost_io.nrs_tbf_rule="$*"
+ [ $? -ne 0 ] &&
+ error "failed to run operate '$*' on TBF rules"
+}
+
+cleanup_tbf_verify()
+{
+ local rc=0
+ trap 0
+ echo "cleanup_tbf $DIR/$tdir"
+ rm -rf $DIR/$tdir
+ rc=$?
+ wait_delete_completed
+ return $rc
+}
+
+tbf_verify() {
+ local dir=$DIR/$tdir
+ local client1=${CLIENT1:-$(hostname)}
+ local myRUNAS="$3"
+
+ local np=$(check_cpt_number ost1)
+ [ $np -gt 0 ] || error "CPU partitions should not be $np."
+ echo "cpu_npartitions on ost1 is $np"
+
+ mkdir $dir || error "mkdir $dir failed"
+ $LFS setstripe -c 1 -i 0 $dir || error "setstripe to $dir failed"
+ chmod 777 $dir
+
+ trap cleanup_tbf_verify EXIT
+ echo "Limited write rate: $1, read rate: $2"
+ echo "Verify the write rate is under TBF control"
+ local start=$SECONDS
+ do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \
+ bs=1M count=100 oflag=direct 2>&1
+ local runtime=$((SECONDS - start + 1))
+ local rate=$(bc <<< "scale=6; 100 / $runtime")
+ echo "Write runtime is $runtime s, speed is $rate IOPS"
+
+ # verify the write rate does not exceed TBF rate limit
+ [ $(bc <<< "$rate < 1.1 * $np * $1") -eq 1 ] ||
+ error "The write rate ($rate) exceeds 110% of rate limit ($1 * $np)"
+
+ cancel_lru_locks osc
+
+ echo "Verify the read rate is under TBF control"
+ start=$SECONDS
+ do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \
+ bs=1M count=100 iflag=direct 2>&1
+ runtime=$((SECONDS - start + 1))
+ rate=$(bc <<< "scale=6; 100 / $runtime")
+ echo "Read runtime is $runtime s, speed is $rate IOPS"
+
+ # verify the read rate does not exceed TBF rate limit
+ [ $(bc <<< "$rate < 1.1 * $np * $2") -eq 1 ] ||
+ error "The read rate ($rate) exceeds 110% of rate limit ($2 * $np)"
+
+ cancel_lru_locks osc
+ cleanup_tbf_verify || error "rm -rf $dir failed"
+}
+
+test_77e() {
+ local rc
+
+ oss=$(comma_list $(osts_nodes))
+
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid" ||
+ rc=$?
+ [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
+ [[ $rc -ne 0 ]] && error "failed to set TBF NID policy"
+
+ local idis
+ local rateis
+ if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
+ idis="nid="
+ rateis="rate="
+ fi
+
+ # Only operate rules on ost1 since OSTs might run on the same OSS
+ # Add some rules
+ tbf_rule_operate ost1 "start\ localhost\ ${idis}{0@lo}\ ${rateis}1000"
+ local address=$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")
+ local client_nids=$(nids_list $address "\\")
+ tbf_rule_operate ost1 "start\ clients\ ${idis}{$client_nids}\ ${rateis}100"
+ tbf_rule_operate ost1 "start\ others\ ${idis}{*.*.*.*@$NETTYPE}\ ${rateis}50"
+ nrs_write_read
+
+ # Change the rules
+ tbf_rule_operate ost1 "change\ localhost\ ${rateis}1001"
+ tbf_rule_operate ost1 "change\ clients\ ${rateis}101"
+ tbf_rule_operate ost1 "change\ others\ ${rateis}51"
+ nrs_write_read
+
+ # Stop the rules
+ tbf_rule_operate ost1 "stop\ localhost"
+ tbf_rule_operate ost1 "stop\ clients"
+ tbf_rule_operate ost1 "stop\ others"
+ nrs_write_read
+
+ # Cleanup the TBF policy
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
+ [ $? -ne 0 ] && error "failed to set policy back to fifo"
+ nrs_write_read
+ return 0
+}
+run_test 77e "check TBF NID nrs policy"
+
+test_77f() {
+ local rc
+
+ oss=$(comma_list $(osts_nodes))
+
+ do_nodes $oss $LCTL set_param \
+ ost.OSS.ost_io.nrs_policies="tbf\ jobid" || rc=$?
+ [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
+ [[ $rc -ne 0 ]] && error "failed to set TBF JOBID policy"
+
+ # Configure jobid_var
+ local saved_jobid_var=$($LCTL get_param -n jobid_var)
+ rc=$?
+ [[ $rc -eq 3 ]] && skip "jobid_var not found" && return
+ [[ $rc -ne 0 ]] && error "failed to get param jobid_var"
+ if [ $saved_jobid_var != procname_uid ]; then
+ set_conf_param_and_check client \
+ "$LCTL get_param -n jobid_var" \
+ "$FSNAME.sys.jobid_var" procname_uid
+ fi
+
+ local idis
+ local rateis
+ if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
+ idis="jobid="
+ rateis="rate="
+ fi
+
+ # Only operate rules on ost1 since OSTs might run on the same OSS
+ # Add some rules
+ tbf_rule_operate ost1 "start\ runas\ ${idis}{iozone.$RUNAS_ID\ dd.$RUNAS_ID\ tiotest.$RUNAS_ID}\ ${rateis}1000"
+ tbf_rule_operate ost1 "start\ iozone_runas\ ${idis}{iozone.$RUNAS_ID}\ ${rateis}100"
+ tbf_rule_operate ost1 "start\ dd_runas\ ${idis}{dd.$RUNAS_ID}\ ${rateis}50"
+ nrs_write_read "$RUNAS"
+
+ # Change the rules
+ tbf_rule_operate ost1 "change\ runas\ ${rateis}1001"
+ tbf_rule_operate ost1 "change\ iozone_runas\ ${rateis}101"
+ tbf_rule_operate ost1 "change\ dd_runas\ ${rateis}51"
+ nrs_write_read "$RUNAS"
+
+ # Stop the rules
+ tbf_rule_operate ost1 "stop\ runas"
+ tbf_rule_operate ost1 "stop\ iozone_runas"
+ tbf_rule_operate ost1 "stop\ dd_runas"
+ nrs_write_read "$RUNAS"
+
+ # Cleanup the TBF policy
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
+ [ $? -ne 0 ] && error "failed to set policy back to fifo"
+ nrs_write_read "$RUNAS"
+
+ local current_jobid_var=$($LCTL get_param -n jobid_var)
+ [[ $? -ne 0 ]] && error "failed to get param jobid_var"
+ if [ $saved_jobid_var != $current_jobid_var ]; then
+ set_conf_param_and_check client \
+ "$LCTL get_param -n jobid_var" \
+ "$FSNAME.sys.jobid_var" $saved_jobid_var
+ fi
+ return 0
+}
+run_test 77f "check TBF JobID nrs policy"
+
+test_77g() {
+ local rc=0
+
+ oss=$(comma_list $(osts_nodes))
+
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid" ||
+ rc=$?
+ [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
+ [[ $rc -ne 0 ]] && error "failed to set TBF NID policy"
+
+ do_nodes $oss lctl set_param \
+ ost.OSS.ost_io.nrs_policies="tbf\ jobid" || rc=$?
+ [[ $rc -ne 0 ]] && error "failed to set TBF JOBID policy"
+
+ local idis
+ local rateis
+ if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
+ idis="jobid="
+ rateis="rate="
+ fi
+
+ # Add a rule that only valid for Jobid TBF. If direct change between
+ # TBF types is not supported, this operation will fail.
+ tbf_rule_operate ost1 "start\ dd_runas\ ${idis}{dd.$RUNAS_ID}\ ${rateis}50"
+
+ # Cleanup the TBF policy
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
+ [ $? -ne 0 ] && error "failed to set policy back to fifo"
+ return 0
+}
+run_test 77g "Change TBF type directly"
+
+test_77h() {
+ [ $(lustre_version_code ost1) -ge $(version_code 2.8.55) ] ||
+ { skip "Need OST version at least 2.8.55"; return 0; }
+
+ local old_policy=$(do_facet ost1 \
+ lctl get_param ost.OSS.ost_io.nrs_policies)
+ local new_policy
+
+ do_facet ost1 lctl set_param \
+ ost.OSS.ost_io.nrs_policies="abc"
+ [ $? -eq 0 ] && error "should return error"
+
+ do_facet ost1 lctl set_param \
+ ost.OSS.ost_io.nrs_policies="tbf\ abc"
+ [ $? -eq 0 ] && error "should return error"
+
+ do_facet ost1 lctl set_param \
+ ost.OSS.ost_io.nrs_policies="tbf\ reg\ abc"
+ [ $? -eq 0 ] && error "should return error"
+
+ do_facet ost1 lctl set_param \
+ ost.OSS.ost_io.nrs_policies="tbf\ abc\ efg"
+ [ $? -eq 0 ] && error "should return error"
+
+ new_policy=$(do_facet ost1 lctl get_param ost.OSS.ost_io.nrs_policies)
+ [ $? -eq 0 ] || error "shouldn't LBUG"
+
+ [ "$old_policy" = "$new_policy" ] || error "NRS policy should be same"
+
+ return 0
+}
+run_test 77h "Wrong policy name should report error, not LBUG"
+
+tbf_rule_check()
+{
+ local facet=$1
+ local expected=$2
+ local error_message=$3
+ local rule_number=0
+ for rule in $expected; do
+ rule_number=$((rule_number + 1))
+ done
+ local stop_line=$(($rule_number + 3))
+ local awk_command="awk 'NR >= 4 && NR <= $stop_line {print \$1}'"
+
+ local output=$(do_facet $facet lctl get_param \
+ ost.OSS.ost_io.nrs_tbf_rule |
+ eval $awk_command |
+ tr "\n" " " |
+ sed 's/[ ]*$//')
+ if [ "$output" != "$expected" ]; then
+ error "$error_message, expected '$expected', got '$output'"
+ fi
+}
+
+test_77i() {
+ [ $(lustre_version_code ost1) -ge $(version_code 2.8.55) ] ||
+ { skip "Need OST version at least 2.8.55"; return 0; }
+
+ for i in $(seq 1 $OSTCOUNT)
+ do
+ do_facet ost"$i" lctl set_param \
+ ost.OSS.ost_io.nrs_policies="tbf\ jobid"
+ [ $? -ne 0 ] &&
+ error "failed to set TBF policy"
+ done
+
+ tbf_rule_check ost1 "default" "error before inserting any rule"
+
+ tbf_rule_operate ost1 "start\ before\ jobid={jobid}\ rate=1000"
+ tbf_rule_check ost1 "before default" \
+ "error when inserting rule 'before'"
+
+ tbf_rule_operate ost1 "start\ after\ jobid={jobid}\ rate=1000\ rank=default"
+ tbf_rule_check ost1 "before after default" \
+ "error when inserting rule 'after'"
+
+ tbf_rule_operate ost1 "start\ target\ jobid={jobid}\ rate=1000\ rank=after"
+ tbf_rule_check ost1 "before target after default" \
+ "error when inserting rule 'target'"
+
+ echo "Move before itself"
+ tbf_rule_operate ost1 "change\ target\ rank=target"
+ tbf_rule_check ost1 "before target after default" \
+ "error when moving before itself"
+
+ echo "Move to higher rank"
+ tbf_rule_operate ost1 "change\ target\ rank=before"
+ tbf_rule_check ost1 "target before after default" \
+ "error when moving to higher rank"
+
+ echo "Move to lower rank"
+ tbf_rule_operate ost1 "change\ target\ rank=after"
+ tbf_rule_check ost1 "before target after default" \
+ "error when moving to lower rank"
+
+ echo "Move before default"
+ tbf_rule_operate ost1 "change\ target\ rank=default"
+ tbf_rule_check ost1 "before after target default" \
+ error "error when moving before default"
+
+ # Cleanup the TBF policy
+ do_nodes $(comma_list $(osts_nodes)) \
+ $LCTL set_param ost.OSS.ost_io.nrs_policies=fifo
+ return 0
+}
+run_test 77i "Change rank of TBF rule"
+
+test_77j() {
+ local idis
+ local rateis
+ local ost_version=$(lustre_version_code ost1)
+
+ [ $ost_version -ge $(version_code 2.9.53) ] ||
+ { skip "Need OST version at least 2.9.53"; return 0; }
+ if [ $ost_version -ge $(version_code 2.8.60) ]; then
+ idis="opcode="
+ rateis="rate="
+ fi
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param jobid_var=procname_uid \
+ ost.OSS.ost_io.nrs_policies="tbf\ opcode" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ost_r\ ${idis}{ost_read}\ ${rateis}5" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ost_w\ ${idis}{ost_write}\ ${rateis}20"
+ [ $? -ne 0 ] && error "failed to set TBF OPCode policy"
+
+ nrs_write_read
+ tbf_verify 20 5
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_r" \
+ ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_w" \
+ ost.OSS.ost_io.nrs_policies="fifo"
+
+ # sleep 3 seconds to wait the tbf policy stop completely,
+ # or the next test case is possible get -EAGAIN when
+ # setting the tbf policy
+ sleep 3
+}
+run_test 77j "check TBF-OPCode NRS policy"
+
+test_77k() {
+ [[ $(lustre_version_code ost1) -ge $(version_code 2.9.53) ]] ||
+ { skip "Need OST version at least 2.9.53"; return 0; }
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_policies="tbf" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ext_w\ jobid={dd.$RUNAS_ID}\&opcode={ost_write}\ rate=20" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ext_r\ jobid={dd.$RUNAS_ID}\&opcode={ost_read}\ rate=10"
+
+ nrs_write_read "$RUNAS"
+ tbf_verify 20 10 "$RUNAS"
+
+ local address=$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")
+ local client_nids=$(nids_list $address "\\")
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_w" \
+ ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_r" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ext_w\ nid={0@lo\ $client_nids}\&opcode={ost_write}\ rate=20" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ext_r\ nid={0@lo\ $client_nids}\&opcode={ost_read}\ rate=10"
+
+ nrs_write_read
+ tbf_verify 20 10
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_w" \
+ ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_r" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ext\ nid={0@lo\ $client_nids}\&jobid={dd.$RUNAS_ID}\ rate=20"
+
+ nrs_write_read "$RUNAS"
+ tbf_verify 20 20 "$RUNAS"
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ext_a\ jobid={dd.$RUNAS_ID},opcode={ost_write}\ rate=20" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ ext_b\ jobid={dd.$RUNAS_ID},opcode={ost_read}\ rate=10"
+
+ nrs_write_read "$RUNAS"
+ # with parameter "RUNAS", it will match the latest rule
+ # "ext_b" first, so the limited write rate is 10.
+ tbf_verify 10 10 "$RUNAS"
+ tbf_verify 20 10
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_a" \
+ ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_b" \
+ ost.OSS.ost_io.nrs_policies="fifo"
+
+ sleep 3
+}
+run_test 77k "check the extended TBF policy with NID/JobID/OPCode expression"
+
+test_77l() {
+ [[ $(lustre_version_code ost1) -ge $(version_code 2.10.56) ]] ||
+ { skip "Need OST version at least 2.10.56"; return 0; }
+
+ do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid"
+ do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="tbf"
+
+ local output=$(do_facet ost1 lctl get_param \
+ ost.OSS.ost_io.nrs_policies | \
+ awk '/name: tbf/ {print;exit}' | \
+ awk -F ': ' '{print $2}')
+
+ if [ "$output" != "tbf" ]; then
+ error "The generic TBF output is '$output', not 'tbf'"
+ fi
+
+ do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
+}
+run_test 77l "check the output of NRS policies for generic TBF"
+
+test_77m() {
+ if [ $(lustre_version_code ost1) -lt $(version_code 2.9.54) ]; then
+ skip "Need OST version at least 2.9.54"
+ return 0
+ fi
+
+ local dir=$DIR/$tdir
+
+ mkdir $dir || error "mkdir $dir failed"
+ $LFS setstripe -c $OSTCOUNT $dir || error "setstripe to $dir failed"
+ chmod 777 $dir
+
+ local nodes=$(comma_list $(osts_nodes))
+ do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies=delay \
+ ost.OSS.ost_io.nrs_delay_min=4 \
+ ost.OSS.ost_io.nrs_delay_max=4 \
+ ost.OSS.ost_io.nrs_delay_pct=100
+ [ $? -ne 0 ] && error "Failed to set delay policy"
+
+ local start=$SECONDS
+ do_nodes "${SINGLECLIENT:-$HOSTNAME}" "$RUNAS" \
+ dd if=/dev/zero of="$dir/nrs_delay_$HOSTNAME" bs=1M count=1 \
+ oflag=direct conv=fdatasync ||
+ { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
+ error "dd on client failed (1)"; }
+ local elapsed=$((SECONDS - start))
+
+ # NRS delay doesn't do sub-second timing, so a request enqueued at
+ # 0.9 seconds can be dequeued at 4.0
+ [ $elapsed -lt 3 ] &&
+ { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
+ error "Single 1M write should take at least 3 seconds"; }
+
+ start=$SECONDS
+ do_nodes "${SINGLECLIENT:-$HOSTNAME}" "$RUNAS" \
+ dd if=/dev/zero of="$dir/nrs_delay_$HOSTNAME" bs=1M count=10 \
+ oflag=direct conv=fdatasync ||
+ { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
+ error "dd on client failed (2)"; }
+ elapsed=$((SECONDS - start))
+
+ [ $elapsed -lt 30 ] &&
+ { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
+ error "Ten 1M writes should take at least 30 seconds"; }
+
+ do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
+ [ $? -ne 0 ] && error "failed to set policy back to fifo"
+
+ return 0
+}
+run_test 77m "check NRS Delay slows write RPC processing"
+
+test_78() { #LU-6673
+ local rc
+
+ oss=$(comma_list $(osts_nodes))
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="orr" &
+ do_nodes $oss lctl set_param ost.OSS.*.nrs_orr_quantum=1
+ rc=$?
+ [[ $rc -eq 3 ]] && skip "no NRS exists" && return
+ # Valid return codes are:
+ # 0: Tuning succeeded
+ # ENODEV: Policy is still stopped
+ # EAGAIN: Policy is being initialized
+ [ $rc -eq 0 -o $rc -eq 19 -o $rc -eq 11 ] ||
+ error "Expected set_param to return 0|ENODEV|EAGAIN"
+
+ # Cleanup the ORR policy
+ do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
+ [ $? -ne 0 ] && error "failed to set policy back to fifo"
+ return 0
+}
+run_test 78 "Enable policy and specify tunings right away"
+
+test_79() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ test_mkdir $DIR/$tdir
+
+ # Prevent interference from layout intent RPCs due to
+ # asynchronous writeback. These will be tested in 130c below.
+ do_nodes ${CLIENTS:-$HOSTNAME} sync
+
+ setfattr -n trusted.name1 -v value1 $DIR/$tdir ||
+ error "setfattr -n trusted.name1=value1 $DIR/$tdir failed"
+
+#define OBD_FAIL_MDS_INTENT_DELAY 0x160
+ local mdtidx=$($LFS getstripe -M $DIR/$tdir)
+ local facet=mds$((mdtidx + 1))
+ stat $DIR/$tdir
+ set_nodes_failloc $(facet_active_host $facet) 0x80000160
+ getfattr -n trusted.name1 $DIR/$tdir 2> /dev/null &
+ local pid=$!
+ sleep 2
+
+#define OBD_FAIL_MDS_GETXATTR_PACK 0x131
+ set_nodes_failloc $(facet_active_host $facet) 0x80000131
+
+ wait $pid
+ return 0
+}
+run_test 79 "xattr: intent error"
+
+test_80a() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ local MDTIDX=1
+ local mdt_index
+ local i
+ local file
+ local pid
+
+ mkdir -p $DIR1/$tdir/dir
+ createmany -o $DIR1/$tdir/dir/f 10 ||
+ error "create files under remote dir failed $i"
+
+ cp /etc/passwd $DIR1/$tdir/$tfile
+
+ #migrate open file should fails
+ multiop_bg_pause $DIR2/$tdir/$tfile O_c || error "open $file failed"
+ pid=$!
+ # give multiop a chance to open
+ sleep 1
+
+ $LFS migrate -m $MDTIDX $DIR1/$tdir &&