]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: drop client metrics during recovery 57084/head
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 25 Apr 2024 00:44:58 +0000 (20:44 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 25 Apr 2024 00:59:29 +0000 (20:59 -0400)
Fixes: https://tracker.ceph.com/issues/65660
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/MDSRank.cc
src/mds/MDSRank.h
src/mds/MetricsHandler.cc

index 3815a73b4205aa09cfb1e545dfac1dd67c0652b9..c51d681c8610576dbdd66c7a6394f948f965b5b4 100644 (file)
@@ -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();
index ea33b011ee52dc7f68ac4c2cee98757b2ec64c57..72553c2089e3c9ea353ffc53e3dfbdea4b1c0e41 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>
@@ -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();
     }
@@ -672,6 +675,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 b28b06b7ad294cbe0225b1d47ac3ea2d47c1dad4..9ad10b9d6e62e873a960ca126343745b963a33e2 100644 (file)
@@ -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);