]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: free mdsdir inode/dirfrag during stopping mds
authorYan, Zheng <zyan@redhat.com>
Thu, 6 Apr 2017 12:31:11 +0000 (20:31 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 11 May 2017 06:13:23 +0000 (14:13 +0800)
make valgrind happy

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/MDCache.cc

index 8f0ca76accb298a1b8f63a9b203b88afcf1bd794..fcdcc2c57c470bab91eac4a0526543251975150e 100644 (file)
@@ -7547,20 +7547,6 @@ bool MDCache::shutdown_pass()
   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());
-
-  // Still replicas of mydir?
-  if ((mydir != NULL) && mydir->inode->is_replicated()) {
-    // We do this because otherwise acks to locks could come in after
-    // we cap the log.
-    dout(7) << "waiting for mydir replicas to release: " << *mydir << dendl;
-    return false;
-  }
 
   // flush what we can from the log
   mds->mdlog->trim(0);
@@ -7606,6 +7592,22 @@ bool MDCache::shutdown_pass()
     //dump();
     return false;
   }
+
+  // make mydir subtree go away
+  if (mydir) {
+    if (mydir->get_num_ref() > 1) { // subtree pin
+      dout(7) << "there's still reference to mydir " << *mydir << dendl;
+      show_cache();
+      return false;
+    }
+
+    remove_subtree(mydir);
+    myin->close_dirfrag(mydir->get_frag());
+  }
+  assert(subtrees.empty());
+
+  if (myin)
+    remove_inode(myin);
   
   // done!
   dout(2) << "shutdown done." << dendl;