]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: remove mdsdir in the final step of shutdown MDS
authorYan, Zheng <zheng.z.yan@intel.com>
Thu, 1 May 2014 21:22:35 +0000 (05:22 +0800)
committerYan, Zheng <zheng.z.yan@intel.com>
Tue, 6 May 2014 23:10:16 +0000 (07:10 +0800)
Otherwise we may get bad subtree map if we restart the MDS before
the shutdown process finishes.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
src/mds/MDCache.cc

index be32002e98460a4bf463226082b4ae1ed52bba0b..c10d52a3980f0222c258658f16596d51270b2279 100644 (file)
@@ -7306,17 +7306,12 @@ bool MDCache::shutdown_pass()
     return false;
   }
 
-  // make mydir subtree go away
-  if (myin) {
-    CDir *mydir = myin->get_dirfrag(frag_t());
-    if (mydir && mydir->is_subtree_root()) {
-      adjust_subtree_auth(mydir, CDIR_AUTH_UNKNOWN);
-      remove_subtree(mydir);
-    }
-  }
-  
+  CDir *mydir = myin ? myin->get_dirfrag(frag_t()) : NULL;
+  if (mydir && !mydir->is_subtree_root())
+    mydir = NULL;
+
   // subtrees map not empty yet?
-  if (!subtrees.empty()) {
+  if (subtrees.size() > (mydir ? 1 : 0)) {
     dout(7) << "still have " << num_subtrees() << " subtrees" << dendl;
     show_subtrees();
     migrator->show_importing();
@@ -7325,10 +7320,16 @@ bool MDCache::shutdown_pass()
       show_cache();
     return false;
   }
-  assert(subtrees.empty());
   assert(!migrator->is_exporting());
   assert(!migrator->is_importing());
 
+  // make mydir subtree go away
+  if (mydir) {
+    adjust_subtree_auth(mydir, CDIR_AUTH_UNKNOWN);
+    remove_subtree(mydir);
+  }
+  assert(subtrees.empty());
+
   // (only do this once!)
   if (!mds->mdlog->is_capped()) {
     dout(7) << "capping the log" << dendl;