From 7e58045f0e3226882f7b608300e70fd0c97dd6bf Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 22 Mar 2016 14:20:12 -0700 Subject: [PATCH] OSD::handle_pg_create: check same_primary_since Rather than add a flag to handle_pg_peering_evt, check same_primary_since here and pass the create event to handle_pg_peering_evt as if it originated at the current epoch (the project_pg_history checks in handle_pg_peering_evt will be noops). Fixes: tracker.ceph.com/issues/15241 Signed-off-by: Samuel Just --- src/osd/OSD.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 1bff914749155..f0401ff0e31d8 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -7479,15 +7479,28 @@ void OSD::handle_pg_create(OpRequestRef op) // cannot be on the other side of a map gap assert(valid_history); + // The mon won't resend unless the primary changed, so + // we ignore same_interval_since. We'll pass this history + // to handle_pg_peering_evt with the current epoch as the + // event -- the project_pg_history check in + // handle_pg_peering_evt will be a noop. + if (history.same_primary_since > m->epoch) { + dout(10) << __func__ << ": got obsolete pg create on pgid " + << pgid << " from epoch " << m->epoch + << ", primary changed in " << history.same_primary_since + << dendl; + continue; + } + handle_pg_peering_evt( pgid, history, pi, - m->epoch, + osdmap->get_epoch(), PG::CephPeeringEvtRef( new PG::CephPeeringEvt( - m->epoch, - m->epoch, + osdmap->get_epoch(), + osdmap->get_epoch(), PG::NullEvt())) ); } -- 2.39.5