]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/OSDMap: clean out pg_temp mappings that exceed pool size
authorSage Weil <sage@redhat.com>
Mon, 6 Aug 2018 18:12:33 +0000 (13:12 -0500)
committerSage Weil <sage@redhat.com>
Fri, 7 Sep 2018 22:11:18 +0000 (17:11 -0500)
If the pool size is reduced, we can end up with pg_temp mappings that are
too big.  This can trigger bad behavior elsewhere (e.g., OSDMapMapping,
which assumes that acting and up are always <= pool size).

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

index ddc3ab8f27e5a04ab4960af6f337fa37dcd380b2..ed960ba9163595f5de9d85a1ad1f128d04733782 100644 (file)
@@ -1675,9 +1675,19 @@ void OSDMap::clean_temps(CephContext *cct,
     vector<int> raw_up;
     int primary;
     tmpmap.pg_to_raw_up(pg.first, &raw_up, &primary);
+    bool remove = false;
     if (raw_up == pg.second) {
       ldout(cct, 10) << __func__ << "  removing pg_temp " << pg.first << " "
                     << pg.second << " that matches raw_up mapping" << dendl;
+      remove = true;
+    }
+    // oversized pg_temp?
+    if (pg.second.size() > tmpmap.get_pg_pool(pg.first.pool())->get_size()) {
+      ldout(cct, 10) << __func__ << "  removing pg_temp " << pg.first << " "
+                    << pg.second << " exceeds pool size" << dendl;
+      remove = true;
+    }
+    if (remove) {
       if (oldmap.pg_temp->count(pg.first))
        pending_inc->new_pg_temp[pg.first].clear();
       else