fragment_unmark_unfreeze_dirs(dirs);
}
+ // MDCache::shutdown_export_strays() always exports strays to mds.0
+ if (who == mds_rank_t(0))
+ shutdown_exported_strays.clear();
+
show_subtrees();
}
bool MDCache::shutdown_export_strays()
{
- if (mds->get_nodeid() == 0) return true;
+ if (mds->get_nodeid() == 0)
+ return true;
dout(10) << "shutdown_export_strays" << dendl;
+ bool mds0_active = mds->mdsmap->is_active(mds_rank_t(0));
+
bool done = true;
- static set<inodeno_t> exported_strays;
list<CDir*> dfs;
for (int i = 0; i < NUM_STRAY; ++i) {
if (!dir->is_complete()) {
dir->fetch(0);
done = false;
+ if (!mds0_active)
+ break;
}
for (CDir::map_t::iterator p = dir->items.begin();
++p) {
CDentry *dn = p->second;
CDentry::linkage_t *dnl = dn->get_linkage();
- if (dnl->is_null()) continue;
+ if (dnl->is_null())
+ continue;
done = false;
+ if (!mds0_active)
+ break;
if (dn->state_test(CDentry::STATE_PURGING)) {
// Don't try to migrate anything that is actually
continue;
}
- // FIXME: we'll deadlock if a rename fails.
- if (exported_strays.count(dnl->get_inode()->ino()) == 0) {
- exported_strays.insert(dnl->get_inode()->ino());
+ if (shutdown_exported_strays.count(dnl->get_inode()->ino()) == 0) {
+ shutdown_exported_strays.insert(dnl->get_inode()->ino());
stray_manager.migrate_stray(dn, mds_rank_t(0)); // send to root!
} else {
dout(10) << "already exporting " << *dn << dendl;