summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-09-25 15:47:28 -0700
committerSage Weil <sage@inktank.com>2013-09-25 15:47:39 -0700
commit4d8f78bc6577521ce1872b9285722a303dee5f85 (patch)
treea5571ee8a04b172804003eb1b02d565c31466742
parentaead63cf0b90e03f2d4f2ccf4441982ae0bc7e33 (diff)
downloadceph-4d8f78bc6577521ce1872b9285722a303dee5f85.tar.gz
mon/PGMonitor: fix segfault when osdmap and pgmap stats are out of sync
The leader mon is responsible for propagating changes in the osdmap into the pgmap (e.g., when a pool or osd goes away). If that hasn't happened yet, the pg_map map will be out of sync with the current set of pools. We shouldn't crash. Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/mon/PGMonitor.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc
index 76cfde7de0e..0f495052747 100644
--- a/src/mon/PGMonitor.cc
+++ b/src/mon/PGMonitor.cc
@@ -1865,6 +1865,8 @@ void PGMonitor::get_health(list<pair<health_status_t,string> >& summary,
p != pg_map.pg_pool_sum.end();
++p) {
const pg_pool_t *pi = mon->osdmon()->osdmap.get_pg_pool(p->first);
+ if (!pi)
+ continue; // in case osdmap changes haven't propagated to PGMap yet
if (pi->get_pg_num() > pi->get_pgp_num()) {
ostringstream ss;
ss << "pool " << mon->osdmon()->osdmap.get_pool_name(p->first) << " pg_num "