diff options
Diffstat (limited to 'src/mds/MDSRank.cc')
-rw-r--r-- | src/mds/MDSRank.cc | 60 |
1 files changed, 49 insertions, 11 deletions
diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 2878887e335..91e7d4a7d55 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -673,9 +673,9 @@ void MDSRank::update_targets() void MDSRank::hit_export_target(mds_rank_t rank, double amount) { - double rate = g_conf()->mds_bal_target_decay; + double rate = g_conf().get_val<double>("mds_bal_target_decay"); if (amount < 0.0) { - amount = 100.0/g_conf()->mds_bal_target_decay; /* a good default for "i am trying to keep this export_target active" */ + amount = 100.0/rate; /* a good default for "i am trying to keep this export_target active" */ } auto em = export_targets.emplace(std::piecewise_construct, std::forward_as_tuple(rank), std::forward_as_tuple(DecayRate(rate))); auto &counter = em.first->second; @@ -1724,7 +1724,10 @@ void MDSRank::boot_start(BootStep step, int r) } else { dout(2) << "Booting: " << step << ": positioning at end of old mds log" << dendl; mdlog->append(); - starting_done(); + auto sle = mdcache->create_subtree_map(); + mdlog->submit_entry(sle); + mdlog->flush(); + mdlog->wait_for_safe(new C_MDS_VoidFn(this, &MDSRank::starting_done)); } break; case MDS_BOOT_REPLAY_DONE: @@ -1771,9 +1774,6 @@ void MDSRank::starting_done() ceph_assert(is_starting()); request_state(MDSMap::STATE_ACTIVE); - auto sle = mdcache->create_subtree_map(); - mdlog->submit_entry(sle); - // sync snaptable cache snapclient->sync(new C_MDSInternalNoop); } @@ -2130,6 +2130,8 @@ void MDSRank::active_start() { dout(1) << "active_start" << dendl; + m_is_active = true; + if (last_state == MDSMap::STATE_CREATING || last_state == MDSMap::STATE_STARTING) { mdcache->open_root(); @@ -2878,7 +2880,12 @@ void MDSRankDispatcher::handle_asok_command( r = config_client(client_id, !got_value, option, value, *css); } else if (command == "scrub start" || command == "scrub_start") { - if (whoami != 0) { + if (!is_active()) { + *css << "MDS is not active"; + r = -CEPHFS_EINVAL; + goto out; + } + else if (whoami != 0) { *css << "Not rank 0"; r = -CEPHFS_EXDEV; goto out; @@ -2904,7 +2911,12 @@ void MDSRankDispatcher::handle_asok_command( })); return; } else if (command == "scrub abort") { - if (whoami != 0) { + if (!is_active()) { + *css << "MDS is not active"; + r = -CEPHFS_EINVAL; + goto out; + } + else if (whoami != 0) { *css << "Not rank 0"; r = -CEPHFS_EXDEV; goto out; @@ -2919,7 +2931,12 @@ void MDSRankDispatcher::handle_asok_command( })); return; } else if (command == "scrub pause") { - if (whoami != 0) { + if (!is_active()) { + *css << "MDS is not active"; + r = -CEPHFS_EINVAL; + goto out; + } + else if (whoami != 0) { *css << "Not rank 0"; r = -CEPHFS_EXDEV; goto out; @@ -2934,7 +2951,12 @@ void MDSRankDispatcher::handle_asok_command( })); return; } else if (command == "scrub resume") { - if (whoami != 0) { + if (!is_active()) { + *css << "MDS is not active"; + r = -CEPHFS_EINVAL; + goto out; + } + else if (whoami != 0) { *css << "Not rank 0"; r = -CEPHFS_EXDEV; goto out; @@ -3115,7 +3137,7 @@ void MDSRankDispatcher::evict_clients( dout(20) << __func__ << " matched " << victims.size() << " sessions" << dendl; if (victims.empty()) { - on_finish(0, {}, outbl); + on_finish(-ESRCH, "no hosts match", outbl); return; } @@ -4042,9 +4064,23 @@ const char** MDSRankDispatcher::get_tracked_conf_keys() const "fsid", "host", "mds_alternate_name_max", + "mds_bal_export_pin", "mds_bal_fragment_dirs", + "mds_bal_fragment_fast_factor", "mds_bal_fragment_interval", "mds_bal_fragment_size_max", + "mds_bal_interval", + "mds_bal_max", + "mds_bal_max_until", + "mds_bal_merge_size", + "mds_bal_mode", + "mds_bal_replicate_threshold", + "mds_bal_sample_interval", + "mds_bal_split_bits", + "mds_bal_split_rd", + "mds_bal_split_size", + "mds_bal_split_wr", + "mds_bal_unreplicate_threshold", "mds_cache_memory_limit", "mds_cache_mid", "mds_cache_reservation", @@ -4072,6 +4108,7 @@ const char** MDSRankDispatcher::get_tracked_conf_keys() const "mds_inject_journal_corrupt_dentry_first", "mds_inject_migrator_session_race", "mds_inject_rename_corrupt_dentry_first", + "mds_kill_dirfrag_at", "mds_kill_shutdown_at", "mds_log_event_large_threshold", "mds_log_events_per_segment", @@ -4110,6 +4147,7 @@ const char** MDSRankDispatcher::get_tracked_conf_keys() const void MDSRankDispatcher::handle_conf_change(const ConfigProxy& conf, const std::set<std::string>& changed) { // XXX with or without mds_lock! + dout(2) << __func__ << ": " << changed << dendl; if (changed.count("mds_heartbeat_reset_grace")) { _heartbeat_reset_grace = conf.get_val<uint64_t>("mds_heartbeat_reset_grace"); |