]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/DaemonServer: prevent merge if either pg is remapped|upmap
authorSage Weil <sage@redhat.com>
Mon, 24 Sep 2018 18:03:05 +0000 (13:03 -0500)
committerSage Weil <sage@redhat.com>
Sat, 20 Oct 2018 20:21:58 +0000 (15:21 -0500)
Remapping means they could be on different OSDs.

Fixes: http://tracker.ceph.com/issues/36166
Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/DaemonServer.cc
src/osd/OSDMap.h

index c643cd8aaf291774e93adfc01ba451ca12c50969..374fd4e1e63b0ddfe075e7ccf22f156efbaf3368 100644 (file)
@@ -2282,6 +2282,23 @@ void DaemonServer::adjust_pgs()
                pg_t merge_source(p.get_pg_num() - 1, i.first);
                pg_t merge_target = merge_source.get_parent();
                bool ok = true;
+
+               if (osdmap.have_pg_upmaps(merge_target)) {
+                 dout(10) << "pool " << i.first
+                          << " pg_num_target " << p.get_pg_num_target()
+                          << " pg_num " << p.get_pg_num()
+                          << " - merge target " << merge_target
+                          << " has upmap" << dendl;
+                 ok = false;
+               } else if (osdmap.have_pg_upmaps(merge_source)) {
+                 dout(10) << "pool " << i.first
+                          << " pg_num_target " << p.get_pg_num_target()
+                          << " pg_num " << p.get_pg_num()
+                          << " - merge source " << merge_source
+                          << " has upmap" << dendl;
+                 ok = false;
+               }
+
                auto q = pg_map.pg_stat.find(merge_source);
                if (p.get_pg_num() != p.get_pg_num_pending()) {
                  dout(10) << "pool " << i.first
@@ -2315,7 +2332,15 @@ void DaemonServer::adjust_pgs()
                           << " not clean (" << pg_state_string(q->second.state)
                           << ")" << dendl;
                  ok = false;
+               } else if (q->second.state & PG_STATE_REMAPPED) {
+                 dout(10) << "pool " << i.first
+                          << " pg_num_target " << p.get_pg_num_target()
+                          << " pg_num " << p.get_pg_num()
+                          << " - merge source " << merge_source
+                          << " remapped" << dendl;
+                 ok = false;
                }
+
                q = pg_map.pg_stat.find(merge_target);
                if (q == pg_map.pg_stat.end()) {
                  dout(10) << "pool " << i.first
@@ -2334,6 +2359,13 @@ void DaemonServer::adjust_pgs()
                           << " not clean (" << pg_state_string(q->second.state)
                           << ")" << dendl;
                  ok = false;
+               } else if (q->second.state & PG_STATE_REMAPPED) {
+                 dout(10) << "pool " << i.first
+                          << " pg_num_target " << p.get_pg_num_target()
+                          << " pg_num " << p.get_pg_num()
+                          << " - merge target " << merge_target
+                          << " remapped" << dendl;
+                 ok = false;
                }
                if (ok) {
                  unsigned target = p.get_pg_num() - 1;
index abaaddb5afad8468c496f5104957527d5fa89813..52f7fd4f8832b5315c5689f844fb4f59c65d0272 100644 (file)
@@ -1381,6 +1381,11 @@ public:
 
   int get_osds_by_bucket_name(const string &name, set<int> *osds) const;
 
+  bool have_pg_upmaps(pg_t pg) const {
+    return pg_upmap.count(pg) ||
+      pg_upmap_items.count(pg);
+  }
+
   /*
    * handy helpers to build simple maps...
    */