From: Sage Weil Date: Tue, 26 Jul 2011 23:10:48 +0000 (-0700) Subject: mds: fix projected rename adjustment X-Git-Tag: v0.33~144 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=56f955b3ffdde500bdd77679e003be3ee8de1f83;p=ceph.git mds: fix projected rename adjustment - 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 --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 75da26f92fc5..7c0124f50da1 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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); - } } } }