From ab7df6d57337847128731a9f8c0d07689946b6d6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 5 May 2017 11:43:59 -0400 Subject: [PATCH 1/2] mon/OSDMonitor: fix prime_pg_temp condition We have to make sure the *pg* exists, not just the pool, in the previous map, or else we'll get a funky overrun in OSDMapMapping::get(). Signed-off-by: Sage Weil --- src/mon/OSDMonitor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 379e229b1fe..a0bcb279bde 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1077,7 +1077,7 @@ void OSDMonitor::prime_pg_temp( return; } } - if (!osdmap.have_pg_pool(pgid.pool())) { + if (!osdmap.pg_exists(pgid)) { return; } From 897566070a2b18269b101965dee71b48b1fc1c7d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 5 May 2017 11:47:03 -0400 Subject: [PATCH 2/2] osd/OSDMapMapping: add assert This is easier to debug than walking off into memory we don't own! Signed-off-by: Sage Weil --- src/osd/OSDMapMapping.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/osd/OSDMapMapping.h b/src/osd/OSDMapMapping.h index c325693785e..81996641ec0 100644 --- a/src/osd/OSDMapMapping.h +++ b/src/osd/OSDMapMapping.h @@ -285,6 +285,7 @@ public: int *acting_primary) const { auto p = pools.find(pgid.pool()); assert(p != pools.end()); + assert(pgid.ps() < p->second.pg_num); p->second.get(pgid.ps(), up, up_primary, acting, acting_primary); }