Skip to content

Commit

Permalink
mds: drop client metrics during recovery
Browse files Browse the repository at this point in the history
Fixes: https://tracker.ceph.com/issues/65660
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
  • Loading branch information
batrick committed Apr 25, 2024
1 parent 4e213a5 commit 83f445c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mds/MDSRank.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions src/mds/MDSRank.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef MDS_RANK_H_
#define MDS_RANK_H_

#include <atomic>
#include <string_view>

#include <boost/asio/io_context.hpp>
Expand Down Expand Up @@ -226,6 +227,8 @@ class MDSRank {
bool is_cluster_degraded() const { return cluster_degraded; }
bool allows_multimds_snaps() const { return mdsmap->allows_multimds_snaps(); }

bool is_active_lockless() const { return m_is_active.load(); }

bool is_cache_trimmable() const {
return is_standby_replay() || is_clientreplay() || is_active() || is_stopping();
}
Expand Down Expand Up @@ -672,6 +675,8 @@ class MDSRank {

mono_time starttime = mono_clock::zero();
boost::asio::io_context& ioc;

std::atomic_bool m_is_active = false; /* accessed outside mds_lock */
};

class C_MDS_RetryMessage : public MDSInternalContext {
Expand Down
5 changes: 5 additions & 0 deletions src/mds/MetricsHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ void MetricsHandler::handle_payload(Session *session, const UnknownPayload &payl
}

void MetricsHandler::handle_client_metrics(const cref_t<MClientMetrics> &m) {
if (!mds->is_active_lockless()) {
dout(20) << ": dropping metrics message during recovery" << dendl;
return;
}

std::scoped_lock locker(lock);

Session *session = mds->get_session(m);
Expand Down

0 comments on commit 83f445c

Please sign in to comment.