From patchwork Fri Jan 4 09:02:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1931831 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 795A3DFABD for ; Fri, 4 Jan 2013 09:03:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754090Ab3ADJCz (ORCPT ); Fri, 4 Jan 2013 04:02:55 -0500 Received: from mga01.intel.com ([192.55.52.88]:50946 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753814Ab3ADJCm (ORCPT ); Fri, 4 Jan 2013 04:02:42 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 04 Jan 2013 01:02:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,409,1355126400"; d="scan'208";a="272790030" Received: from zyan5-mobl.sh.intel.com ([10.239.36.28]) by fmsmga002.fm.intel.com with ESMTP; 04 Jan 2013 01:02:40 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 14/29] mds: fix lock state transition check Date: Fri, 4 Jan 2013 17:02:05 +0800 Message-Id: <1357290140-17044-15-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1357290140-17044-1-git-send-email-zheng.z.yan@intel.com> References: <1357290140-17044-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" Locker::simple_excl() and Locker::scatter_mix() miss is_rdlocked check; Locker::file_excl() miss is_rdlocked check and is_wrlocked check. Signed-off-by: Yan, Zheng --- src/mds/Locker.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index dec0a94..e826321 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -3408,6 +3408,8 @@ void Locker::simple_excl(SimpleLock *lock, bool *need_issue) } int gather = 0; + if (lock->is_rdlocked()) + gather++; if (lock->is_wrlocked()) gather++; if (lock->is_xlocked()) @@ -4167,6 +4169,8 @@ void Locker::scatter_mix(ScatterLock *lock, bool *need_issue) } int gather = 0; + if (lock->is_rdlocked()) + gather++; if (in->is_replicated()) { if (lock->get_state() != LOCK_EXCL_MIX && // EXCL replica is already LOCK lock->get_state() != LOCK_XSYN_EXCL) { // XSYN replica is already LOCK; ** FIXME here too! @@ -4237,6 +4241,11 @@ void Locker::file_excl(ScatterLock *lock, bool *need_issue) } int gather = 0; + if (lock->is_rdlocked()) + gather++; + if (lock->is_wrlocked()) + gather++; + if (in->is_replicated() && lock->get_state() != LOCK_LOCK_EXCL && lock->get_state() != LOCK_XSYN_EXCL) { // if we were lock, replicas are already lock.