From 4e724acca3af1fe377c0ce283d38fb107419a96d Mon Sep 17 00:00:00 2001 From: Henri Doreau Date: Thu, 27 Oct 2016 18:11:58 -0400 Subject: [PATCH] staging: lustre: 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. Signed-off-by: Henri Doreau Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6673 Reviewed-on: http://review.whamcloud.com/15104 Reviewed-by: Emoly Liu Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index d88faf6..f856632 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -619,6 +619,15 @@ static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name, goto out; } + /** + * Wait for the policy to be fully started before attempting + * to operate it. + */ + if (policy->pol_state == NRS_POL_STATE_STARTING) { + rc = -EAGAIN; + goto out; + } + switch (opc) { /** * Unknown opcode, pass it down to the policy-specific control -- 2.7.4