From: Patrick Donnelly Date: Fri, 13 Apr 2018 05:54:33 +0000 (-0700) Subject: mds: evict all clients if last mds shutting down X-Git-Tag: v13.1.0~200^2~8 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=283b3a6849215137daf540b9ba5d8a528b998dbe;p=ceph-ci.git mds: evict all clients if last mds shutting down This allows all ranks to stop. If the administrator shuts down the cluster then we should immediately shut down all client's I/O. Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index dd01e194ae9..8d8faf199d0 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1581,9 +1581,27 @@ void MDSRank::stopping_start() dout(2) << "stopping_start" << dendl; if (mdsmap->get_num_in_mds() == 1 && !sessionmap.empty()) { - // we're the only mds up! - dout(0) << "we are the last MDS, and have mounted clients: we cannot flush our journal. suicide!" << dendl; - suicide(); + std::vector victims; + const auto sessions = sessionmap.get_sessions(); + for (const auto p : sessions) { + if (!p.first.is_client()) { + continue; + } + + Session *s = p.second; + victims.push_back(s); + } + + dout(20) << __func__ << " matched " << victims.size() << " sessions" << dendl; + assert(!victims.empty()); + + C_GatherBuilder gather(g_ceph_context, new C_MDSInternalNoop); + for (const auto &s : victims) { + std::stringstream ss; + evict_client(s->get_client().v, false, + g_conf->mds_session_blacklist_on_evict, ss, gather.new_sub()); + } + gather.activate(); } mdcache->shutdown_start();