]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: switch to osdmon when handling osd_pg_creates subs
authorKefu Chai <kchai@redhat.com>
Mon, 27 Mar 2017 03:12:09 +0000 (11:12 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 30 Mar 2017 12:21:18 +0000 (20:21 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mon/OSDMonitor.cc
src/mon/PGMonitor.cc
src/mon/PGMonitor.h

index 0aa20090eaf10ae82a8afe57f77ad27bdccfa433..fd737fef60f5c092bf886ae9cfbe84141fd951e3 100644 (file)
@@ -1177,8 +1177,16 @@ void OSDMonitor::prime_pg_temp(
   const OSDMap& next,
   pg_t pgid)
 {
-  if (!creating_pgs.pgs.count(pgid)) {
-    return;
+  if (mon->monmap->get_required_features().contains_all(
+        ceph::features::mon::FEATURE_LUMINOUS)) {
+    if (!creating_pgs.pgs.count(pgid)) {
+      return;
+    }
+  } else {
+    const auto& pg_map = mon->pgmon()->pg_map;
+    if (!pg_map.creating_pgs.count(pgid)) {
+      return;
+    }
   }
 
   vector<int> up, acting;
@@ -1467,13 +1475,23 @@ void OSDMonitor::share_map_with_random_osd()
 
 version_t OSDMonitor::get_trim_to()
 {
-  {
+  if (mon->monmap->get_required_features().contains_all(
+        ceph::features::mon::FEATURE_LUMINOUS)) {
     std::lock_guard<Spinlock> l(creating_pgs_lock);
     if (!creating_pgs.pgs.empty()) {
       return 0;
     }
+    if (!mon->pgmon()->is_readable()) {
+      return 0;
+    }
+  } else {
+    if (!mon->pgmon()->is_readable())
+      return 0;
+    if (mon->pgmon()->pg_map.creating_pgs.empty()) {
+      return 0;
+    }
   }
-  if (mon->pgmon()->is_readable()) {
+  {
     epoch_t floor = mon->pgmon()->pg_map.get_min_last_epoch_clean();
     dout(10) << " min_last_epoch_clean " << floor << dendl;
     if (g_conf->mon_osd_force_trim_to > 0 &&
index e360303c8110dfb91863335f4da1315a546e437c..617ab1a1878f2136dc0823f09acd4138102c0164 100644 (file)
@@ -1936,16 +1936,18 @@ void PGMonitor::check_subs()
     });
 }
 
-void PGMonitor::check_sub(Subscription *sub)
+bool PGMonitor::check_sub(Subscription *sub)
 {
+  OSDMap& osdmap = mon->osdmon()->osdmap;
   if (sub->type == "osd_pg_creates") {
     // only send these if the OSD is up.  we will check_subs() when they do
     // come up so they will get the creates then.
     if (sub->session->inst.name.is_osd() &&
-        mon->osdmon()->osdmap.is_up(sub->session->inst.name.num())) {
+        osdmap.is_up(sub->session->inst.name.num())) {
       sub->next = send_pg_creates(sub->session->inst.name.num(),
                                   sub->session->con.get(),
                                   sub->next);
     }
   }
+  return true;
 }
index c1eaa2b612da7ae091b9fa4cf3d2838bbd8733ca..dd53b6fe2f53277c822259493ec1435c8bc89126 100644 (file)
@@ -147,7 +147,7 @@ public:
                             const set<int>& s, const char *desc, health_status_t sev) const;
 
   void check_subs();
-  void check_sub(Subscription *sub);
+  bool check_sub(Subscription *sub);
 
 private:
   // no copying allowed