]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: properly create aux subtrees for pinned directory 15300/head
authorYan, Zheng <zyan@redhat.com>
Fri, 26 May 2017 03:41:48 +0000 (11:41 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 26 May 2017 03:46:42 +0000 (11:46 +0800)
Fixes: http://tracker.ceph.com/issues/20083
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/CInode.cc
src/mds/MDBalancer.cc

index bd7a37971c39428733a0fb80c1e051e0d029f40a..567668a12433042ef9f5742dcaec64ce72a7afb7 100644 (file)
@@ -4429,10 +4429,12 @@ void CInode::maybe_export_pin(bool update)
       continue;
     if (export_pin != MDS_RANK_NONE) {
       if (dir->is_subtree_root()) {
-       // export subtrees ?
-       queue = (export_pin != dir->get_dir_auth().first);
+       // set auxsubtree bit or export it
+       if (!dir->state_test(CDir::STATE_AUXSUBTREE) ||
+           export_pin != dir->get_dir_auth().first)
+         queue = true;
       } else {
-       // create aux subtrees
+       // create aux subtree or export it
        queue = true;
       }
     } else {
index 17a055154aa2a65bf6ba378411ff2cab9cd95062..cda09c922637fcece96197ba85a523e58c10b4be 100644 (file)
@@ -107,16 +107,19 @@ void MDBalancer::handle_export_pins(void)
          mds->mdcache->try_subtree_merge(dir);
        }
       } else if (export_pin == mds->get_nodeid()) {
+       if (dir->state_test(CDir::STATE_CREATING) ||
+           dir->is_frozen() || dir->is_freezing()) {
+         // try again later
+         remove = false;
+         continue;
+       }
        if (!dir->is_subtree_root()) {
-         if (dir->state_test(CDir::STATE_CREATING) ||
-             dir->is_frozen() || dir->is_freezing()) {
-           // try again later
-           remove = false;
-           continue;
-         }
          dir->state_set(CDir::STATE_AUXSUBTREE);
          mds->mdcache->adjust_subtree_auth(dir, mds->get_nodeid());
          dout(10) << " create aux subtree on " << *dir << dendl;
+       } else if (!dir->state_test(CDir::STATE_AUXSUBTREE)) {
+         dout(10) << " set auxsubtree bit on " << *dir << dendl;
+         dir->state_set(CDir::STATE_AUXSUBTREE);
        }
       } else {
        mds->mdcache->migrator->export_dir(dir, export_pin);