Whamcloud - gitweb
LU-9227 nrs: Rate change of a TBF rule loses control 85/26085/4
authorQian Yingjin <qian@ddn.com>
Mon, 20 Mar 2017 02:33:54 +0000 (10:33 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 26 Apr 2017 03:39:22 +0000 (03:39 +0000)
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 <qian@ddn.com>
Change-Id: I9cdd469fd57dea692b86285cc26040a117b120ad
Reviewed-on: https://review.whamcloud.com/26085
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/nrs_tbf.c
lustre/tests/sanityn.sh

index d3c6e9e..95fa32b 100644 (file)
@@ -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);
index 58fbd5a..21caf70 100755 (executable)
@@ -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