]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: drop client metrics during recovery
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 25 Apr 2024 00:44:58 +0000 (20:44 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Thu, 9 Jan 2025 19:39:36 +0000 (14:39 -0500)
Fixes: https://tracker.ceph.com/issues/65660
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 83f445c54fe2c61bb9239abdb961be001e34c750)

src/mds/MDSRank.cc
src/mds/MDSRank.h
src/mds/MetricsHandler.cc

index 7d089e89b9cfd947f0342d3d7f3491c38225a6ba..33626f4dc7f70b6227b162dbc7dcc9572a1b792d 100644 (file)
@@ -2103,6 +2103,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();
index a9e8da1817a26368aa6a4b9db2d9abd64115d5bb..f4335d0c68ca4c0e9468d45e6668b5bc388a05f5 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef MDS_RANK_H_
 #define MDS_RANK_H_
 
+#include <atomic>
 #include <string_view>
 
 #include <boost/asio/io_context.hpp>
@@ -224,6 +225,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();
     }
@@ -661,6 +664,8 @@ private:
 
     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 {
index 1fd4de4d2cfd8c66cc03963f698536dcb905fe5e..9fc4c6122a4e976ded15811d0664c57b9a54bcc5 100644 (file)
@@ -332,6 +332,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);