]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMonitor: fix segfault when osdmap and pgmap stats are out of sync 640/head
authorSage Weil <sage@inktank.com>
Wed, 25 Sep 2013 22:47:28 +0000 (15:47 -0700)
committerSage Weil <sage@inktank.com>
Wed, 25 Sep 2013 22:47:39 +0000 (15:47 -0700)
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>
src/mon/PGMonitor.cc

index 76cfde7de0eb81a5924e65a297539fb0b454a0c7..0f495052747e9d63f16089b2dd0bd779e4c4c155 100644 (file)
@@ -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 "