From patchwork Sun Mar 17 14:51: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: 2283631 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 0FA0AE00E5 for ; Sun, 17 Mar 2013 15:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932418Ab3CQOv4 (ORCPT ); Sun, 17 Mar 2013 10:51:56 -0400 Received: from mga03.intel.com ([143.182.124.21]:34328 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932299Ab3CQOvz (ORCPT ); Sun, 17 Mar 2013 10:51:55 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 17 Mar 2013 07:51:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,859,1355126400"; d="scan'208";a="215704176" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.20.118]) by AZSMGA002.ch.intel.com with ESMTP; 17 Mar 2013 07:51:52 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, greg@inktank.com, "Yan, Zheng" Subject: [PATCH 02/39] mds: process finished contexts in batch Date: Sun, 17 Mar 2013 22:51:05 +0800 Message-Id: <1363531902-24909-3-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1363531902-24909-1-git-send-email-zheng.z.yan@intel.com> References: <1363531902-24909-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" If there are several unstable locks in an inode, current Locker::eval(CInode*,) processes each lock's finished contexts seperately. This may cause very deep call stack if finished contexts also call Locker::eval() on the same inode. An extreme example is: Locker::eval() wakes an open request(). Server::handle_client_open() starts a log entry, then call Locker::issue_new_caps(). Locker::issue_new_caps() calls Locker::eval() and wakes another request. The later request also tries starting a log entry. Signed-off-by: Yan, Zheng Reviewed-by: Greg Farnum --- src/mds/Locker.cc | 17 ++++++++++------- src/mds/Locker.h | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index b61fb14..d06a9cc 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -803,6 +803,7 @@ void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, list finishers; dout(10) << "eval " << mask << " " << *in << dendl; @@ -821,19 +822,19 @@ bool Locker::eval(CInode *in, int mask, bool caps_imported) retry: if (mask & CEPH_LOCK_IFILE) - eval_any(&in->filelock, &need_issue, caps_imported); + eval_any(&in->filelock, &need_issue, &finishers, caps_imported); if (mask & CEPH_LOCK_IAUTH) - eval_any(&in->authlock, &need_issue, caps_imported); + eval_any(&in->authlock, &need_issue, &finishers, caps_imported); if (mask & CEPH_LOCK_ILINK) - eval_any(&in->linklock, &need_issue,caps_imported); + eval_any(&in->linklock, &need_issue, &finishers, caps_imported); if (mask & CEPH_LOCK_IXATTR) - eval_any(&in->xattrlock, &need_issue, caps_imported); + eval_any(&in->xattrlock, &need_issue, &finishers, caps_imported); if (mask & CEPH_LOCK_INEST) - eval_any(&in->nestlock, &need_issue, caps_imported); + eval_any(&in->nestlock, &need_issue, &finishers, caps_imported); if (mask & CEPH_LOCK_IFLOCK) - eval_any(&in->flocklock, &need_issue, caps_imported); + eval_any(&in->flocklock, &need_issue, &finishers, caps_imported); if (mask & CEPH_LOCK_IPOLICY) - eval_any(&in->policylock, &need_issue, caps_imported); + eval_any(&in->policylock, &need_issue, &finishers, caps_imported); // drop loner? if (in->is_auth() && in->is_head() && in->get_wanted_loner() != in->get_loner()) { @@ -854,6 +855,8 @@ bool Locker::eval(CInode *in, int mask, bool caps_imported) } } + finish_contexts(g_ceph_context, finishers); + if (need_issue && in->is_head()) issue_caps(in); diff --git a/src/mds/Locker.h b/src/mds/Locker.h index f005925..3f79996 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -99,9 +99,9 @@ public: void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0, list *pfinishers=0); void eval(SimpleLock *lock, bool *need_issue); - void eval_any(SimpleLock *lock, bool *need_issue, bool first=false) { + void eval_any(SimpleLock *lock, bool *need_issue, list *pfinishers=0, bool first=false) { if (!lock->is_stable()) - eval_gather(lock, first, need_issue); + eval_gather(lock, first, need_issue, pfinishers); else if (lock->get_parent()->is_auth()) eval(lock, need_issue); }