staging: lustre: nrs: serialize executions of nrs_policy_stop
authorHenri Doreau <henri.doreau@cea.fr>
Thu, 10 Nov 2016 17:30:44 +0000 (12:30 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Nov 2016 15:02:55 +0000 (16:02 +0100)
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>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7096
Reviewed-on: http://review.whamcloud.com/16214
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@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 f8566324f2589e0a3d580162b019fb91410623a5..7b6ffb1958341c95db7b4b25a4d437dbbd8374f8 100644 (file)
@@ -82,16 +82,9 @@ 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;
-
-       if (policy->pol_desc->pd_ops->op_policy_stop) {
-               spin_unlock(&nrs->nrs_lock);
-
+       if (policy->pol_desc->pd_ops->op_policy_stop)
                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);
@@ -619,11 +612,8 @@ 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) {
+       if (policy->pol_state != NRS_POL_STATE_STARTED &&
+           policy->pol_state != NRS_POL_STATE_STOPPED) {
                rc = -EAGAIN;
                goto out;
        }