From 010dd0fdd78da7dddcb155b9826856228f44bfa3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 11 Mar 2010 16:07:33 -0800 Subject: [PATCH] mds: make mds stopping work (with new mdsdir changes) --- src/mds/MDCache.cc | 28 +++++++++++++++++++++++----- src/mds/Migrator.cc | 4 +--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 969d04b6f046a..2d935f76cbfd9 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -5408,19 +5408,24 @@ bool MDCache::shutdown_pass() it != subtrees.end(); it++) { CDir *dir = it->first; - if (dir->get_inode()->is_stray()) continue; - if (dir->is_frozen() || dir->is_freezing()) continue; - if (!dir->is_full_dir_auth()) continue; + if (dir->get_inode()->is_mdsdir()) + continue; + if (dir->is_frozen() || dir->is_freezing()) + continue; + if (!dir->is_full_dir_auth()) + continue; ls.push_back(dir); } int max = 5; // throttle shutdown exports.. hack! for (list::iterator p = ls.begin(); p != ls.end(); ++p) { CDir *dir = *p; int dest = dir->get_inode()->authority().first; - if (dest > 0 && !mds->mdsmap->is_active(dest)) dest = 0; + if (dest > 0 && !mds->mdsmap->is_active(dest)) + dest = 0; dout(7) << "sending " << *dir << " back to mds" << dest << dendl; migrator->export_dir(dir, dest); - if (--max == 0) break; + if (--max == 0) + break; } } @@ -5429,6 +5434,15 @@ 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); + } + } + // subtrees map not empty yet? if (!subtrees.empty()) { dout(7) << "still have " << num_subtrees() << " subtrees" << dendl; @@ -5491,6 +5505,8 @@ bool MDCache::shutdown_export_strays() if (mds->get_nodeid() == 0) return true; if (!stray) return true; + dout(10) << "shutdown_export_strays" << dendl; + bool done = true; static set exported_strays; list dfs; @@ -5517,6 +5533,8 @@ bool MDCache::shutdown_export_strays() if (exported_strays.count(dnl->get_inode()->ino()) == 0) { exported_strays.insert(dnl->get_inode()->ino()); migrate_stray(dn, mds->get_nodeid(), 0); // send to root! + } else { + dout(10) << "already exporting " << *dn << dendl; } } } diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index f475450699885..4a106637b7103 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -561,9 +561,7 @@ void Migrator::export_dir(CDir *dir, int dest) dout(7) << "cluster degraded, no exports for now" << dendl; return; } - if (dir->inode->is_system() && - !(MDS_INO_IS_MDSDIR(dir->ino()) && (int)dir->ino() - MDS_INO_MDSDIR_OFFSET == dest) && - !(dir->ino() == MDS_INO_MDSDIR(mds->whoami) && mds->is_stopping())) { + if (dir->inode->is_base()) { dout(7) << "i won't export root|stray" << dendl; //assert(0); return; -- 2.39.5