]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: force fragmentation for ambiguous imports as well
authorSage Weil <sage@newdream.net>
Tue, 4 Jan 2011 22:45:34 +0000 (14:45 -0800)
committerSage Weil <sage@newdream.net>
Tue, 4 Jan 2011 23:27:16 +0000 (15:27 -0800)
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 <sage@newdream.net>
src/mds/MDCache.cc

index 5bf8fe4a0168695fd5baade998f64243ebe8c44b..cbe48415d1509ee1ce26edcb3c0aef0e531203c1 100644 (file)
@@ -2524,16 +2524,17 @@ void MDCache::handle_resolve(MMDSResolve *m)
        for (map<dirfrag_t, vector<dirfrag_t> >::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<dirfrag_t>::iterator r = q->second.begin();
-              r != q->second.end();
-              ++r) {
-           CDir *bound = get_dirfrag(*r);
-           if (bound && bound->contains(dir)) {
+         set<CDir*> bounds;
+         get_force_dirfrag_bound_set(q->second, bounds);
+         for (set<CDir*>::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