From: Yan, Zheng Date: Thu, 6 Apr 2017 12:31:11 +0000 (+0800) Subject: mds: free mdsdir inode/dirfrag during stopping mds X-Git-Tag: v12.1.0~10^2~28^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a66724916b424bc4f6e94a42b644096e6bc94a3d;p=ceph.git mds: free mdsdir inode/dirfrag during stopping mds make valgrind happy Signed-off-by: "Yan, Zheng" --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 8f0ca76accb2..fcdcc2c57c47 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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;