Whamcloud - gitweb
LU-7845 gss: support namespace in lgss_keyring
[fs/lustre-release.git] / lustre / ptlrpc / nrs.c
index 67626eb..8d637f3 100644 (file)
@@ -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,14 @@ 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);
+               }
+       }
+
        policy->pol_state = NRS_POL_STATE_STARTED;
 
        if (policy->pol_flags & PTLRPC_NRS_FL_FALLBACK) {