From 9426dc4c2b60066c4da58b2f831f4622e6d72345 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 7 Apr 2018 13:54:49 -0500 Subject: [PATCH] osd: ignore pg creates when pool FLAG_CREATING is not set We only process mon-initiated PG creates while the pool is is CREATING mode. This ensures that we will not have any racing split or merge operations. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 36a6abc81fa3d..a7076cc535f11 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3993,6 +3993,25 @@ PGRef OSD::handle_pg_create_info(const OSDMapRef& osdmap, PG::RecoveryCtx rctx = create_context(); OSDMapRef startmap = get_map(info->epoch); + + if (info->by_mon) { + int64_t pool_id = pgid.pgid.pool(); + const pg_pool_t *pool = osdmap->get_pg_pool(pool_id); + if (!pool) { + dout(10) << __func__ << " ignoring " << pgid << ", pool dne" << dendl; + return nullptr; + } + if (osdmap->require_osd_release >= CEPH_RELEASE_NAUTILUS && + !pool->has_flag(pg_pool_t::FLAG_CREATING)) { + // this ensures we do not process old creating messages after the + // pool's initial pgs have been created (and pg are subsequently + // allowed to split or merge). + dout(20) << __func__ << " dropping " << pgid + << "create, pool does not have CREATING flag set" << dendl; + return nullptr; + } + } + int up_primary, acting_primary; vector up, acting; startmap->pg_to_up_acting_osds( @@ -8532,7 +8551,6 @@ void OSD::handle_fast_pg_create(MOSDPGCreate2 *m) utime_t created_stamp = p.second.second; dout(20) << __func__ << " " << pgid << " e" << created << "@" << created_stamp << dendl; - pg_history_t h; h.epoch_created = created; h.epoch_pool_created = created; -- 2.39.5