staging: lustre: ptlrpc: Forbid too early NRS policy tunings
authorHenri Doreau <henri.doreau@cea.fr>
Thu, 27 Oct 2016 22:11:58 +0000 (18:11 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 30 Oct 2016 15:02:33 +0000 (11:02 -0400)
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 <henri.doreau@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6673
Reviewed-on: http://review.whamcloud.com/15104
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ptlrpc/nrs.c

index d88faf6..f856632 100644 (file)
@@ -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