void MDBalancer::queue_split(const CDir *dir, bool fast)
{
- dout(10) << __func__ << " enqueuing " << *dir
+ constexpr const auto &_func_ = __func__;
+ dout(10) << _func_ << " enqueuing " << *dir
<< " (fast=" << fast << ")" << dendl;
const dirfrag_t df = dir->dirfrag();
return;
}
+ if (mds->is_stopping()) {
+ // not a good time. This could have been (!mds->is_active())
+ // or at least (mds->is_stopping() || mds->is_stopped()), but
+ // is_stopped() is never true because an MDS respawns as soon as it's removed from the map;
+ // the narrow is_stopping check is to avoid potential regressions
+ // due to unknown coupling with other parts of the MDS (especially multiple ranks).
+ dout(5) << "ignoring the " << _func_ << " callback because the MDS state is '" << ceph_mds_state_name(mds->get_state()) << "'" << dendl;
+ return;
+ }
+
auto mdcache = mds->mdcache;
CDir *dir = mdcache->get_dirfrag(df);
// Pass on to MDCache: note that the split might still not
// happen if the checks in MDCache::can_fragment fail.
- dout(10) << __func__ << " splitting " << *dir << dendl;
+ dout(10) << _func_ << " splitting " << *dir << dendl;
int bits = g_conf()->mds_bal_split_bits;
if (dir->inode->is_ephemeral_dist()) {
unsigned min_frag_bits = mdcache->get_ephemeral_dist_frag_bits();
void MDBalancer::queue_merge(CDir *dir)
{
const auto frag = dir->dirfrag();
+ constexpr const auto &_func_ = __func__;
auto callback = [this, frag](int r) {
ceph_assert(frag.frag != frag_t());
// starting one), and this context is the only one that erases it.
merge_pending.erase(frag);
+ if (mds->is_stopping()) {
+ // not a good time. This could have been (!mds->is_active())
+ // or at least (mds->is_stopping() || mds->is_stopped()), but
+ // is_stopped() is never true because an MDS respawns as soon as it's removed from the map;
+ // the narrow is_stopping check is to avoid potential regressions
+ // due to unknown coupling with other parts of the MDS (especially multiple ranks).
+ dout(5) << "ignoring the " << _func_ << " callback because the MDS state is '" << ceph_mds_state_name(mds->get_state()) << "'" << dendl;
+ return;
+ }
+
auto mdcache = mds->mdcache;
CDir *dir = mdcache->get_dirfrag(frag);
if (!dir) {