Skip to content

Commit 426beef

Browse files
committed
Merge PR ceph#57084 into main
* refs/pull/57084/head: mds: drop client metrics during recovery Reviewed-by: Rishabh Dave <[email protected]> Reviewed-by: Xiubo Li <[email protected]> Reviewed-by: Leonid Usov <[email protected]>
2 parents 0fed3f2 + 83f445c commit 426beef

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
}
@@ -669,6 +672,8 @@ class MDSRank {
669672

670673
mono_time starttime = mono_clock::zero();
671674
boost::asio::io_context& ioc;
675+
676+
std::atomic_bool m_is_active = false; /* accessed outside mds_lock */
672677
};
673678

674679
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)