Merge PR #21167 into master

* refs/pull/21167/head:
	mds: make stopping mds export strays and subtree at the same time
	mds: handle client requests while mds is stopping
	mds: check projected linkage before migrating stray dentry

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2018-04-09 21:32:56 -07:00
commit dfca9664d4
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
2 changed files with 22 additions and 20 deletions

View File

@ -7661,20 +7661,7 @@ bool MDCache::shutdown_pass()
}
// empty stray dir
if (!shutdown_export_strays()) {
dout(7) << "waiting for strays to migrate" << dendl;
return false;
}
// drop our reference to our stray dir inode
for (int i = 0; i < NUM_STRAY; ++i) {
if (strays[i] &&
strays[i]->state_test(CInode::STATE_STRAYPINNED)) {
strays[i]->state_clear(CInode::STATE_STRAYPINNED);
strays[i]->put(CInode::PIN_STRAY);
strays[i]->put_stickydirs();
}
}
bool strays_all_exported = shutdown_export_strays();
// trim cache
trim(UINT64_MAX);
@ -7713,6 +7700,11 @@ bool MDCache::shutdown_pass()
}
}
if (!strays_all_exported) {
dout(7) << "waiting for strays to migrate" << dendl;
return false;
}
if (num_auth_subtree > 0) {
dout(7) << "still have " << num_auth_subtree << " auth subtrees" << dendl;
show_subtrees();
@ -7726,6 +7718,16 @@ bool MDCache::shutdown_pass()
return false;
}
// drop our reference to our stray dir inode
for (int i = 0; i < NUM_STRAY; ++i) {
if (strays[i] &&
strays[i]->state_test(CInode::STATE_STRAYPINNED)) {
strays[i]->state_clear(CInode::STATE_STRAYPINNED);
strays[i]->put(CInode::PIN_STRAY);
strays[i]->put_stickydirs();
}
}
CDir *mydir = myin ? myin->get_dirfrag(frag_t()) : NULL;
if (mydir && !mydir->is_subtree_root())
mydir = NULL;
@ -7831,9 +7833,9 @@ bool MDCache::shutdown_export_strays()
list<CDir*> dfs;
for (int i = 0; i < NUM_STRAY; ++i) {
if (!strays[i]) {
if (!strays[i] ||
!strays[i]->state_test(CInode::STATE_STRAYPINNED))
continue;
}
strays[i]->get_dirfrags(dfs);
}
@ -7851,7 +7853,7 @@ bool MDCache::shutdown_export_strays()
for (auto &p : dir->items) {
CDentry *dn = p.second;
CDentry::linkage_t *dnl = dn->get_linkage();
CDentry::linkage_t *dnl = dn->get_projected_linkage();
if (dnl->is_null())
continue;
done = false;

View File

@ -239,8 +239,7 @@ void Server::dispatch(Message *m)
bool wait_for_active = true;
if (mds->is_stopping()) {
if (m->get_source().is_mds())
wait_for_active = false;
wait_for_active = false;
} else if (mds->is_clientreplay()) {
if (req->is_queued_for_replay()) {
wait_for_active = false;
@ -336,7 +335,8 @@ void Server::handle_client_session(MClientSession *m)
if (session->is_opening() ||
session->is_open() ||
session->is_stale() ||
session->is_killing()) {
session->is_killing() ||
terminating_sessions) {
dout(10) << "currently open|opening|stale|killing, dropping this req" << dendl;
// set client metadata for session opened by prepare_force_open_sessions
if (!m->client_meta.empty())