From patchwork Sun Mar 17 14:51:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2283761 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 8F0A5E00E6 for ; Sun, 17 Mar 2013 15:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932624Ab3CQOwl (ORCPT ); Sun, 17 Mar 2013 10:52:41 -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 S932610Ab3CQOwk (ORCPT ); Sun, 17 Mar 2013 10:52:40 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 17 Mar 2013 07:52:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,859,1355126400"; d="scan'208";a="215704321" 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:52:36 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, greg@inktank.com, "Yan, Zheng" Subject: [PATCH 15/39] mds: don't send MDentry{Link, Unlink} before receiving cache rejoin Date: Sun, 17 Mar 2013 22:51:18 +0800 Message-Id: <1363531902-24909-16-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" The active MDS calls MDCache::rejoin_scour_survivor_replicas() when it receives the cache rejoin message. The function will remove the objects replicated by MDentry{Link,Unlink} from replica map. Signed-off-by: Yan, Zheng Reviewed-by: Greg Farnum --- src/mds/MDCache.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 69db1dd..f102205 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -3893,6 +3893,8 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) } } + assert(rejoin_gather.count(from)); + rejoin_gather.erase(from); if (survivor) { // survivor. do everything now. for (map::iterator p = weak->inode_scatterlocks.begin(); @@ -3911,8 +3913,6 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) mds->locker->eval_gather(*p); } else { // done? - assert(rejoin_gather.count(from)); - rejoin_gather.erase(from); if (rejoin_gather.empty()) { rejoin_gather_finish(); } else { @@ -9582,7 +9582,9 @@ void MDCache::send_dentry_link(CDentry *dn) for (map::iterator p = dn->replicas_begin(); p != dn->replicas_end(); ++p) { - if (mds->mdsmap->get_state(p->first) < MDSMap::STATE_REJOIN) + if (mds->mdsmap->get_state(p->first) < MDSMap::STATE_REJOIN || + (mds->mdsmap->get_state(p->first) == MDSMap::STATE_REJOIN && + rejoin_gather.count(p->first))) continue; CDentry::linkage_t *dnl = dn->get_linkage(); MDentryLink *m = new MDentryLink(subtree->dirfrag(), dn->get_dir()->dirfrag(), @@ -9668,6 +9670,11 @@ void MDCache::send_dentry_unlink(CDentry *dn, CDentry *straydn, MDRequest *mdr) if (mdr && mdr->more()->witnessed.count(it->first)) continue; + if (mds->mdsmap->get_state(it->first) < MDSMap::STATE_REJOIN || + (mds->mdsmap->get_state(it->first) == MDSMap::STATE_REJOIN && + rejoin_gather.count(it->first))) + continue; + MDentryUnlink *unlink = new MDentryUnlink(dn->get_dir()->dirfrag(), dn->name); if (straydn) replicate_stray(straydn, it->first, unlink->straybl);