From: John Spray Date: Wed, 15 Jul 2015 12:45:06 +0000 (+0100) Subject: mds: handle data pools missing from osdmap X-Git-Tag: v9.1.0~406^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7337db501f57be6e245f4671f8237f2526ee0670;p=ceph.git mds: handle data pools missing from osdmap This case happens on rank acquisition because we see the MDSMap before the OSDMap, as the continuous watch on OSDMaps doesn't happen when we're in standby. Signed-off-by: John Spray --- diff --git a/src/mds/StrayManager.cc b/src/mds/StrayManager.cc index e57d6293afac..ae05d740ab3c 100644 --- a/src/mds/StrayManager.cc +++ b/src/mds/StrayManager.cc @@ -866,12 +866,21 @@ void StrayManager::handle_conf_change(const struct md_config_t *conf, void StrayManager::update_op_limit() { const OSDMap *osdmap = mds->objecter->get_osdmap_read(); + assert(osdmap != NULL); // Number of PGs across all data pools uint64_t pg_count = 0; const std::set &data_pools = mds->mdsmap->get_data_pools(); for (std::set::iterator i = data_pools.begin(); i != data_pools.end(); ++i) { + if (osdmap->get_pg_pool(*i) == NULL) { + // It is possible that we have an older OSDMap than MDSMap, because + // we don't start watching every OSDMap until after MDSRank is + // initialized + dout(4) << __func__ << " data pool " << *i + << " not found in OSDMap" << dendl; + continue; + } pg_count += osdmap->get_pg_num(*i); }