summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2013-01-16 20:17:23 +0800
committerYan, Zheng <zheng.z.yan@intel.com>2013-01-29 10:17:35 +0800
commitbaa6bd6b1c1e0e09986fca208e3f86f4f8711e69 (patch)
tree4e71a20588b3f1698f4df20501c9d07d315de9cb
parente0aa64d04ddd29fb144b80307d238813d1a43ce3 (diff)
downloadceph-baa6bd6b1c1e0e09986fca208e3f86f4f8711e69.tar.gz
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 <zheng.z.yan@intel.com>
-rw-r--r--src/mds/MDCache.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index b50a58b45ab..9a8d7e7deeb 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -999,17 +999,19 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
}
}
// merge stray bounds?
- set<CDir*>::iterator p = subtrees[dir].begin();
- while (p != subtrees[dir].end()) {
- set<CDir*>::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<CDir*> copy = subtrees[dir];
+ for (set<CDir*>::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.