return true;
}
- // close out any sessions (and open files!) before we try to trim the log, etc.
- if (!mds->server->terminating_sessions &&
- mds->sessionmap.have_unclosed_sessions()) {
- mds->server->terminate_sessions();
- return false;
- }
-
-
// empty stray dir
if (!shutdown_export_strays()) {
dout(7) << "waiting for strays to migrate" << dendl;
dout(5) << "lru size now " << lru.lru_get_size() << dendl;
// SUBTREES
+ int num_auth_subtree = 0;
if (!subtrees.empty() &&
mds->get_nodeid() != 0 &&
!migrator->is_exporting() //&&
CDir *dir = it->first;
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);
+ if (dir->is_auth()) {
+ num_auth_subtree++;
+ if (dir->is_frozen() ||
+ dir->is_freezing() ||
+ dir->is_ambiguous_dir_auth())
+ continue;
+ ls.push_back(dir);
+ }
}
int max = 5; // throttle shutdown exports.. hack!
for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p) {
}
}
- if (!shutdown_export_caps()) {
- dout(7) << "waiting for residual caps to export" << dendl;
+ if (num_auth_subtree > 0) {
+ dout(7) << "still have " << num_auth_subtree << " auth subtrees" << dendl;
+ show_subtrees();
+ return false;
+ }
+
+ // close out any sessions (and open files!) before we try to trim the log, etc.
+ if (mds->sessionmap.have_unclosed_sessions()) {
+ if (!mds->server->terminating_sessions)
+ mds->server->terminate_sessions();
return false;
}
return done;
}
-bool MDCache::shutdown_export_caps()
-{
- // export caps?
- // note: this runs more often than it should.
- static bool exported_caps = false;
- static set<CDir*> exported_caps_in;
- if (!exported_caps) {
- dout(7) << "searching for caps to export" << dendl;
- exported_caps = true;
-
- list<CDir*> dirq;
- for (map<CDir*,set<CDir*> >::iterator p = subtrees.begin();
- p != subtrees.end();
- ++p) {
- if (exported_caps_in.count(p->first)) continue;
- if (p->first->is_auth() ||
- p->first->is_ambiguous_auth())
- exported_caps = false; // we'll have to try again
- else {
- dirq.push_back(p->first);
- exported_caps_in.insert(p->first);
- }
- }
- while (!dirq.empty()) {
- CDir *dir = dirq.front();
- dirq.pop_front();
- for (CDir::map_t::iterator p = dir->items.begin();
- p != dir->items.end();
- ++p) {
- CDentry *dn = p->second;
- CDentry::linkage_t *dnl = dn->get_linkage();
- if (!dnl->is_primary()) continue;
- CInode *in = dnl->get_inode();
- if (in->is_dir())
- in->get_nested_dirfrags(dirq);
- if (in->is_any_caps() && !in->state_test(CInode::STATE_EXPORTINGCAPS))
- migrator->export_caps(in);
- }
- }
- }
-
- return true;
-}
-
-
-
-
-
// ========= messaging ==============
/* This function DOES put the passed message before returning */