]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: clean out pg_temp mappings that exceed pool size 24432/head
authorSage Weil <sage@redhat.com>
Mon, 6 Aug 2018 18:12:33 +0000 (13:12 -0500)
committerNathan Cutler <ncutler@suse.com>
Thu, 4 Oct 2018 15:34:30 +0000 (17:34 +0200)
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>
(cherry picked from commit daf53f423d2c25e60c2039c0125041c7341fbe71)

Conflicts:
src/osd/OSDMap.cc

src/osd/OSDMap.cc

index 91e4f9c261b5f7b7f07a7f48e59221c90e6172ab..f6cf25fd9b27f1e0b6f48b5f89dfe98fb610ba7e 100644 (file)
@@ -1566,9 +1566,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 (vectors_equal(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 (osdmap.pg_temp->count(pg.first))
        pending_inc->new_pg_temp[pg.first].clear();
       else