Skip to content

Commit 83f445c

Browse files
committed
mds: drop client metrics during recovery
Fixes: https://tracker.ceph.com/issues/65660 Signed-off-by: Patrick Donnelly <[email protected]>
1 parent 4e213a5 commit 83f445c

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/mds/MDSRank.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,6 +2130,8 @@ void MDSRank::active_start()
21302130
{
21312131
dout(1) << "active_start" << dendl;
21322132

2133+
m_is_active = true;
2134+
21332135
if (last_state == MDSMap::STATE_CREATING ||
21342136
last_state == MDSMap::STATE_STARTING) {
21352137
mdcache->open_root();

src/mds/MDSRank.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#ifndef MDS_RANK_H_
1616
#define MDS_RANK_H_
1717

18+
#include <atomic>
1819
#include <string_view>
1920

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

230+
bool is_active_lockless() const { return m_is_active.load(); }
231+
229232
bool is_cache_trimmable() const {
230233
return is_standby_replay() || is_clientreplay() || is_active() || is_stopping();
231234
}
@@ -672,6 +675,8 @@ class MDSRank {
672675

673676
mono_time starttime = mono_clock::zero();
674677
boost::asio::io_context& ioc;
678+
679+
std::atomic_bool m_is_active = false; /* accessed outside mds_lock */
675680
};
676681

677682
class C_MDS_RetryMessage : public MDSInternalContext {

src/mds/MetricsHandler.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,11 @@ void MetricsHandler::handle_payload(Session *session, const UnknownPayload &payl
331331
}
332332

333333
void MetricsHandler::handle_client_metrics(const cref_t<MClientMetrics> &m) {
334+
if (!mds->is_active_lockless()) {
335+
dout(20) << ": dropping metrics message during recovery" << dendl;
336+
return;
337+
}
338+
334339
std::scoped_lock locker(lock);
335340

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

0 commit comments

Comments
 (0)