From patchwork Wed Jan 23 03:08:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2021991 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 043C1DFB7A for ; Wed, 23 Jan 2013 03:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753405Ab3AWDJw (ORCPT ); Tue, 22 Jan 2013 22:09:52 -0500 Received: from mga11.intel.com ([192.55.52.93]:51770 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753035Ab3AWDJV (ORCPT ); Tue, 22 Jan 2013 22:09:21 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 22 Jan 2013 19:09:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,518,1355126400"; d="scan'208";a="280925035" Received: from zyan5-mobl.sh.intel.com ([10.239.36.31]) by fmsmga002.fm.intel.com with ESMTP; 22 Jan 2013 19:09:19 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 18/25] mds: fix for MDCache::adjust_bounded_subtree_auth Date: Wed, 23 Jan 2013 11:08:54 +0800 Message-Id: <1358910541-15535-19-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1358910541-15535-1-git-send-email-zheng.z.yan@intel.com> References: <1358910541-15535-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" After swallowing extra subtrees, subtree bounds may change, so it should re-check. Signed-off-by: Yan, Zheng --- src/mds/MDCache.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 542f4a6..e951a39 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -999,17 +999,19 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set& bounds, pair::iterator p = subtrees[dir].begin(); - while (p != subtrees[dir].end()) { - set::iterator n = p; - n++; - if (bounds.count(*p) == 0) { - CDir *stray = *p; - dout(10) << " swallowing extra subtree at " << *stray << dendl; - adjust_subtree_auth(stray, auth); - try_subtree_merge_at(stray); - } - p = n; + while (!subtrees[dir].empty()) { + set copy = subtrees[dir]; + for (set::iterator p = copy.begin(); p != copy.end(); p++) { + if (bounds.count(*p) == 0) { + CDir *stray = *p; + dout(10) << " swallowing extra subtree at " << *stray << dendl; + adjust_subtree_auth(stray, auth); + try_subtree_merge_at(stray); + } + } + // swallowing subtree may add new subtree bounds + if (copy == subtrees[dir]) + break; } // bound should now match.