From daf53f423d2c25e60c2039c0125041c7341fbe71 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 6 Aug 2018 13:12:33 -0500 Subject: [PATCH] osd/OSDMap: clean out pg_temp mappings that exceed pool size 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 --- src/osd/OSDMap.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index ddc3ab8f27e..ed960ba9163 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1675,9 +1675,19 @@ void OSDMap::clean_temps(CephContext *cct, vector 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 -- 2.39.5