From baa6bd6b1c1e0e09986fca208e3f86f4f8711e69 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Wed, 16 Jan 2013 20:17:23 +0800 Subject: [PATCH] mds: fix for MDCache::adjust_bounded_subtree_auth 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 b50a58b45abdf..9a8d7e7deebed 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. -- 2.39.5