Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-7334 lprocfs: Allow default multiplier of 1
[fs/lustre-release.git]
/
lustre
/
ptlrpc
/
nrs.c
diff --git
a/lustre/ptlrpc/nrs.c
b/lustre/ptlrpc/nrs.c
index
1b07c8a
..
8d637f3
100644
(file)
--- a/
lustre/ptlrpc/nrs.c
+++ b/
lustre/ptlrpc/nrs.c
@@
-86,17
+86,11
@@
static int nrs_policy_ctl_locked(struct ptlrpc_nrs_policy *policy,
static void nrs_policy_stop0(struct ptlrpc_nrs_policy *policy)
{
static void nrs_policy_stop0(struct ptlrpc_nrs_policy *policy)
{
- struct ptlrpc_nrs *nrs = policy->pol_nrs;
ENTRY;
ENTRY;
- if (policy->pol_desc->pd_ops->op_policy_stop != NULL) {
- spin_unlock(&nrs->nrs_lock);
-
+ if (policy->pol_desc->pd_ops->op_policy_stop != NULL)
policy->pol_desc->pd_ops->op_policy_stop(policy);
policy->pol_desc->pd_ops->op_policy_stop(policy);
- spin_lock(&nrs->nrs_lock);
- }
-
LASSERT(list_empty(&policy->pol_list_queued));
LASSERT(policy->pol_req_queued == 0 &&
policy->pol_req_started == 0);
LASSERT(list_empty(&policy->pol_list_queued));
LASSERT(policy->pol_req_queued == 0 &&
policy->pol_req_started == 0);
@@
-270,14
+264,6
@@
static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy, char *arg)
RETURN(-ENODEV);
}
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
*/
/**
* Serialize policy starting across the NRS head
*/
@@
-300,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) {
policy->pol_state = NRS_POL_STATE_STARTED;
if (policy->pol_flags & PTLRPC_NRS_FL_FALLBACK) {
@@
-671,6
+665,10
@@
static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name,
if (policy == NULL)
GOTO(out, rc = -ENOENT);
if (policy == NULL)
GOTO(out, rc = -ENOENT);
+ if (policy->pol_state != NRS_POL_STATE_STARTED &&
+ policy->pol_state != NRS_POL_STATE_STOPPED)
+ GOTO(out, rc = -EAGAIN);
+
switch (opc) {
/**
* Unknown opcode, pass it down to the policy-specific control
switch (opc) {
/**
* Unknown opcode, pass it down to the policy-specific control