]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix projected rename adjustment
authorSage Weil <sage@newdream.net>
Tue, 26 Jul 2011 23:10:48 +0000 (16:10 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 27 Jul 2011 03:44:17 +0000 (20:44 -0700)
- we may journal one (or _maybe_ both, probably not) of the subtree root
  addition OR the bound addition, depending on whether oldparent and
  newparent are auth.
- we can't rely on get_subtree_root() to move bounds since the projected
  subtree isn't a root in the real tree.  use CDir::contains() instead.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/MDCache.cc

index 75da26f92fc5aa50dbe6f976fc978be059c27c0b..7c0124f50da17a1070bfd3522686da5d29689cae 100644 (file)
@@ -2293,12 +2293,14 @@ ESubtreeMap *MDCache::create_subtree_map()
       } else {
        // mid-subtree.
 
-       if (oldparent->get_dir_auth() != newparent->get_dir_auth() &&
-           oldparent->get_dir_auth().first == mds->whoami) {
+       if (oldparent->get_dir_auth() != newparent->get_dir_auth()) {
          dout(10) << " creating subtree for " << dir->dirfrag() << dendl;
+         // if oldparent is auth, subtree is mine; include it.
+         if (oldparent->get_dir_auth().first == mds->whoami)
+           le->subtrees[dir->dirfrag()].clear();
+         // if newparent is auth, subtree is a new bound
          if (le->subtrees.count(newparent->dirfrag()))
-           le->subtrees[newparent->dirfrag()].push_back(dir->dirfrag());
-         le->subtrees[dir->dirfrag()].clear();
+           le->subtrees[newparent->dirfrag()].push_back(dir->dirfrag());  // newparent is auth; new bound
          newparent = dir;
        }
 
@@ -2307,11 +2309,9 @@ ESubtreeMap *MDCache::create_subtree_map()
             p != subtrees[oldparent].end();
             ++p) {
          CDir *bound = *p;
-         CDir *broot = get_subtree_root(bound->get_parent_dir());
-         if (broot != oldparent) {
+         if (dir->contains(bound->get_parent_dir()))
            _move_subtree_map_bound(bound->dirfrag(), oldparent->dirfrag(), newparent->dirfrag(),
                                    le->subtrees);
-         }
        }
       }
     }