Whamcloud - gitweb
LU-7096 nrs: serialize executions of nrs_policy_stop 14/16214/4
authorHenri Doreau <henri.doreau@cea.fr>
Thu, 3 Sep 2015 11:38:40 +0000 (13:38 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 19 Sep 2015 03:37:42 +0000 (03:37 +0000)
Do not release nrs_lock in nrs_policy_stop0 to prevent op_policy_stop()
from being executed concurrently.

Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Change-Id: Ie42793021aa47ff7e2c14eb58b3d6e8405fa8407
Reviewed-on: http://review.whamcloud.com/16214
Tested-by: Jenkins
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/nrs.c
lustre/ptlrpc/nrs_tbf.c

index 96ca9f2..67626eb 100644 (file)
@@ -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)
 {
-       struct ptlrpc_nrs *nrs = policy->pol_nrs;
        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);
 
-               spin_lock(&nrs->nrs_lock);
-       }
-
        LASSERT(list_empty(&policy->pol_list_queued));
        LASSERT(policy->pol_req_queued == 0 &&
                policy->pol_req_started == 0);
@@ -671,11 +665,8 @@ static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name,
        if (policy == NULL)
                GOTO(out, rc = -ENOENT);
 
-       /**
-        * Wait for the policy to be fully started before attempting
-        * to operate it.
-        */
-       if (policy->pol_state == NRS_POL_STATE_STARTING)
+       if (policy->pol_state != NRS_POL_STATE_STARTED &&
+           policy->pol_state != NRS_POL_STATE_STOPPED)
                GOTO(out, rc = -EAGAIN);
 
        switch (opc) {
index 7fb0f4e..5e57cfe 100644 (file)
@@ -1184,9 +1184,7 @@ static void nrs_tbf_stop(struct ptlrpc_nrs_policy *policy)
        LASSERT(cfs_binheap_is_empty(head->th_binheap));
        cfs_binheap_destroy(head->th_binheap);
        OBD_FREE_PTR(head);
-       spin_lock(&nrs->nrs_lock);
        nrs->nrs_throttling = 0;
-       spin_unlock(&nrs->nrs_lock);
        wake_up(&policy->pol_nrs->nrs_svcpt->scp_waitq);
 }