From 3fcefcaafcdbc532109042f993a0f28f7f553cf3 Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Mon, 20 Mar 2017 10:33:54 +0800 Subject: [PATCH] LU-9227 nrs: Rate change of a TBF rule loses control In some test cases, i.e. start dd_0 {dd.0} 1000 dd if=/dev/zero of=/mnt/lustre/test bs=1M count=100 start dd_1000 {dd.1000} 1000 After ran above commands, changing rate of dd_0 take no effect. The reason is that starting rule dd_1000 increases the sequence, but the sequence number of the class with id "dd.0" does not change accordingly, resulting in failure of rate change. This patch fixes this problem. Signed-off-by: Qian Yingjin Change-Id: I9cdd469fd57dea692b86285cc26040a117b120ad Reviewed-on: https://review.whamcloud.com/26085 Reviewed-by: Emoly Liu Reviewed-by: Li Xi Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/ptlrpc/nrs_tbf.c | 7 +++++-- lustre/tests/sanityn.sh | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index d3c6e9e..95fa32b 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -2367,10 +2367,13 @@ static int nrs_tbf_res_get(struct ptlrpc_nrs_policy *policy, struct nrs_tbf_rule *rule; rule = nrs_tbf_rule_match(head, cli); - if (rule != cli->tc_rule) + if (rule != cli->tc_rule) { nrs_tbf_cli_reset(head, rule, cli); - else + } else { + if (cli->tc_rule_generation != rule->tr_generation) + nrs_tbf_cli_reset_value(head, cli); nrs_tbf_rule_put(rule); + } } else if (cli->tc_rule_generation != cli->tc_rule->tr_generation) { nrs_tbf_cli_reset_value(head, cli); diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 58fbd5a..21caf70 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -3033,7 +3033,7 @@ nrs_write_read() { 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)" + error "dd at ${i}MB on client failed (3)" & local pids_r[$i]=$! done cancel_lru_locks osc @@ -3417,6 +3417,7 @@ test_77j() { 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 -- 1.8.3.1