From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965076AbcKJRbf (ORCPT ); Thu, 10 Nov 2016 12:31:35 -0500 Received: from smtp2.ccs.ornl.gov ([160.91.203.11]:48746 "EHLO smtp2.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965049AbcKJRbd (ORCPT ); Thu, 10 Nov 2016 12:31:33 -0500 From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Cc: Linux Kernel Mailing List , Lustre Development List , Henri Doreau , James Simmons Subject: [PATCH 14/35] staging: lustre: nrs: serialize executions of nrs_policy_stop Date: Thu, 10 Nov 2016 12:30:44 -0500 Message-Id: <1478799065-24841-15-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1478799065-24841-1-git-send-email-jsimmons@infradead.org> References: <1478799065-24841-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Henri Doreau Do not release nrs_lock in nrs_policy_stop0 to prevent op_policy_stop() from being executed concurrently. Signed-off-by: Henri Doreau Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7096 Reviewed-on: http://review.whamcloud.com/16214 Reviewed-by: Lai Siyao Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index f856632..7b6ffb1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -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; } -- 1.7.1