Whamcloud - gitweb
LU-6673 ptlrpc: Forbid too early NRS policy tunings 04/15104/9
authorHenri Doreau <henri.doreau@cea.fr>
Tue, 2 Jun 2015 15:48:32 +0000 (17:48 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 29 Aug 2015 01:03:20 +0000 (01:03 +0000)
Wait for a NRS policy to be fully started before allowing
to apply related tunings, so that all fields are properly
initialized.

Add corresponding test to sanityn.

Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Change-Id: I92df8f55aebd173a26979e9a506c45f985107d8a
Reviewed-on: http://review.whamcloud.com/15104
Tested-by: Jenkins
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/nrs.c
lustre/tests/sanityn.sh

index 1b07c8a..96ca9f2 100644 (file)
@@ -671,6 +671,13 @@ static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name,
        if (policy == NULL)
                GOTO(out, rc = -ENOENT);
 
        if (policy == NULL)
                GOTO(out, rc = -ENOENT);
 
+       /**
+        * Wait for the policy to be fully started before attempting
+        * to operate it.
+        */
+       if (policy->pol_state == NRS_POL_STATE_STARTING)
+               GOTO(out, rc = -EAGAIN);
+
        switch (opc) {
                /**
                 * Unknown opcode, pass it down to the policy-specific control
        switch (opc) {
                /**
                 * Unknown opcode, pass it down to the policy-specific control
index 4fa584a..12eea99 100644 (file)
@@ -3081,6 +3081,32 @@ test_77g() {
 }
 run_test 77g "Change TBF type directly"
 
 }
 run_test 77g "Change TBF type directly"
 
+test_78() { #LU-6673
+       local rc
+
+       for i in $(seq 1 $OSTCOUNT)
+       do
+               do_facet ost"$i" lctl set_param \
+                       ost.OSS.ost_io.nrs_policies="orr" &
+               do_facet ost"$i" lctl set_param \
+                       ost.OSS.*.nrs_orr_quantum=1
+               rc=$?
+               [ $rc -eq 0 -o $rc -eq 11 ] ||
+                       error "Expected set_param to return 0 or EAGAIN"
+       done
+
+       # Cleanup the ORR policy
+       for i in $(seq 1 $OSTCOUNT)
+       do
+               do_facet ost"$i" lctl set_param \
+                       ost.OSS.ost_io.nrs_policies="fifo"
+               [ $? -ne 0 ] &&
+                       error "failed to set policy back to fifo"
+       done
+       return 0
+}
+run_test 78 "Enable policy and specify tunings right away"
+
 test_80a() {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local MDTIDX=1
 test_80a() {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local MDTIDX=1