From 23c2acaa6c47ae7408f8b61a58a2f57fe4af6869 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 16 Dec 2016 18:10:18 -0500 Subject: [PATCH] mon/PGMonitor: fix force_create_pg We weren't carefully registering the creating PG. In particular, the current osd mappings (acting, up, etc.) weren't getting filled in, which meant the PG wasn't (necessarily) mapped to an OSD until the OSDMap updated and we recalculated mappings. Fix by sending us through the common code path so that all fields get updated properly. Fixes: http://tracker.ceph.com/issues/18298 Signed-off-by: Sage Weil --- src/mon/PGMap.h | 1 - src/mon/PGMonitor.cc | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 7787d6cbb02e36..1c86ab3afffdb9 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -412,7 +412,6 @@ class PGMapUpdater PGMap *pg_map, PGMap::Incremental *pending_inc); -protected: static void register_pg( const OSDMap &osd_map, pg_t pgid, epoch_t epoch, diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index bb7f276371fa93..e36ea367a854f7 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1372,10 +1372,13 @@ bool PGMonitor::prepare_command(MonOpRequestRef op) goto reply; } { - pg_stat_t& s = pending_inc.pg_stat_updates[pgid]; - s.state = PG_STATE_CREATING; - s.created = epoch; - s.last_change = ceph_clock_now(g_ceph_context); + PGMapUpdater::register_pg( + mon->osdmon()->osdmap, + pgid, + epoch, + true, + &pg_map, + &pending_inc); } ss << "pg " << pgidstr << " now creating, ok"; goto update;