From d4db3f18e523256f6c562a8993332f7fb7d70486 Mon Sep 17 00:00:00 2001 From: Henri Doreau Date: Tue, 2 Jun 2015 17:48:32 +0200 Subject: [PATCH] LU-6673 ptlrpc: Forbid too early NRS policy tunings 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 Change-Id: I92df8f55aebd173a26979e9a506c45f985107d8a Reviewed-on: http://review.whamcloud.com/15104 Tested-by: Jenkins Reviewed-by: Emoly Liu Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/ptlrpc/nrs.c | 7 +++++++ lustre/tests/sanityn.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lustre/ptlrpc/nrs.c b/lustre/ptlrpc/nrs.c index 1b07c8a..96ca9f2 100644 --- a/lustre/ptlrpc/nrs.c +++ b/lustre/ptlrpc/nrs.c @@ -671,6 +671,13 @@ static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name, 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 diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 4fa584a..12eea99 100644 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -3081,6 +3081,32 @@ test_77g() { } 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 -- 1.8.3.1