From patchwork Sun Mar 17 14:51:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2283641 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 29178E00E6 for ; Sun, 17 Mar 2013 15:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932471Ab3CQOv7 (ORCPT ); Sun, 17 Mar 2013 10:51:59 -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 S932299Ab3CQOv6 (ORCPT ); Sun, 17 Mar 2013 10:51:58 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 17 Mar 2013 07:51:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,859,1355126400"; d="scan'208";a="215704193" 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:55 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, greg@inktank.com, "Yan, Zheng" Subject: [PATCH 03/39] mds: fix MDCache::adjust_bounded_subtree_auth() Date: Sun, 17 Mar 2013 22:51:06 +0800 Message-Id: <1363531902-24909-4-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" There are cases that need both create new bound and swallow intervening subtree. For example: A MDS exports subtree A with bound B and imports subtree B with bound C at the same time. The MDS crashes, exporting subtree A fails, but importing subtree B succeed. During recovery, the MDS may create new bound C and swallow subtree B. Signed-off-by: Yan, Zheng Reviewed-by: Greg Farnum --- src/mds/MDCache.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 684e70b..19dc60b 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -980,15 +980,21 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set& bounds, pairget_parent_dir()); + if (subtrees[t].count(bound) == 0) { + assert(t != dir); + dout(10) << " new bound " << *bound << dendl; + adjust_subtree_auth(bound, t->authority()); + } // make sure it's nested beneath ambiguous subtree(s) while (1) { - CDir *t = get_subtree_root(bound->get_parent_dir()); - if (t == dir) break; while (subtrees[dir].count(t) == 0) t = get_subtree_root(t->get_parent_dir()); dout(10) << " swallowing intervening subtree at " << *t << dendl; adjust_subtree_auth(t, auth); try_subtree_merge_at(t); + t = get_subtree_root(bound->get_parent_dir()); + if (t == dir) break; } } }