From 3d04d96b5cd0ab9d94904d035347c00fe19f687a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 4 Jan 2011 14:45:34 -0800 Subject: [PATCH] mds: force fragmentation for ambiguous imports as well Handle needed refragmentation for processing ambiguous bounds. That means forcing the peers' subtree root fragmentation, and also interpreting the peer's bounds appropriately, given that the peer's fragmentation may not match our own. Signed-off-by: Sage Weil --- src/mds/MDCache.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 5bf8fe4a01686..cbe48415d1509 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -2524,16 +2524,17 @@ void MDCache::handle_resolve(MMDSResolve *m) for (map >::iterator q = m->subtrees.begin(); q != m->subtrees.end(); ++q) { - CDir *base = get_dirfrag(q->first); + // an ambiguous import won't race with a refragmentation; it's appropriate to force here. + CDir *base = get_force_dirfrag(q->first); if (!base || !base->contains(dir)) continue; // base not dir or an ancestor of dir, clearly doesn't claim dir. bool inside = true; - for (vector::iterator r = q->second.begin(); - r != q->second.end(); - ++r) { - CDir *bound = get_dirfrag(*r); - if (bound && bound->contains(dir)) { + set bounds; + get_force_dirfrag_bound_set(q->second, bounds); + for (set::iterator p = bounds.begin(); p != bounds.end(); ++p) { + CDir *bound = *p; + if (bound->contains(dir)) { inside = false; // nope, bound is dir or parent of dir, not inside. break; } @@ -2712,7 +2713,8 @@ void MDCache::disambiguate_imports() q != p->second.end(); ++q) { dout(10) << " ambiguous import " << q->first << " bounds " << q->second << dendl; - CDir *dir = get_dirfrag(q->first); + // an ambiguous import will not race with a refragmentation; it's appropriate to force here. + CDir *dir = get_force_dirfrag(q->first); if (!dir) continue; if (dir->authority().first == CDIR_AUTH_UNKNOWN || // if i am resolving -- 2.39.5