X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnrs.c;h=52d3225deba6bb7ed1c7193cd87539cc3931b846;hb=a231148843bd4a30d962378841160602180c88d8;hp=67626ebd6e61771f6ded4eaab84608d2c1fe6de8;hpb=654bbf7fcc7a4c83d41e70d728e971eaed7994fe;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/nrs.c b/lustre/ptlrpc/nrs.c index 67626eb..52d3225 100644 --- a/lustre/ptlrpc/nrs.c +++ b/lustre/ptlrpc/nrs.c @@ -20,7 +20,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2011, 2014, Intel Corporation. + * Copyright (c) 2014, 2016, Intel Corporation. * * Copyright 2012 Xyratex Technology Limited */ @@ -264,14 +264,6 @@ static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy, char *arg) RETURN(-ENODEV); } - if (arg != NULL) { - if (strlen(arg) + 1 > sizeof(policy->pol_arg)) { - CERROR("NRS: arg '%s' is too long\n", arg); - GOTO(out, rc = -E2BIG); - } - strncpy(policy->pol_arg, arg, sizeof(policy->pol_arg)); - } - /** * Serialize policy starting across the NRS head */ @@ -294,6 +286,16 @@ static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy, char *arg) } } + if (arg != NULL) { + if (strlcpy(policy->pol_arg, arg, sizeof(policy->pol_arg)) >= + sizeof(policy->pol_arg)) { + CERROR("NRS: arg '%s' is too long\n", arg); + GOTO(out, rc = -E2BIG); + } + } else { + policy->pol_arg[0] = '\0'; + } + policy->pol_state = NRS_POL_STATE_STARTED; if (policy->pol_flags & PTLRPC_NRS_FL_FALLBACK) { @@ -1811,6 +1813,10 @@ int ptlrpc_nrs_init(void) rc = ptlrpc_nrs_policy_register(&nrs_conf_tbf); if (rc != 0) GOTO(fail, rc); + + rc = ptlrpc_nrs_policy_register(&nrs_conf_delay); + if (rc != 0) + GOTO(fail, rc); #endif /* HAVE_SERVER_SUPPORT */ RETURN(rc);