]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD::handle_pg_create: check same_primary_since 8382/head
authorSamuel Just <sjust@redhat.com>
Tue, 22 Mar 2016 21:20:12 +0000 (14:20 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 30 Mar 2016 22:34:31 +0000 (15:34 -0700)
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 <sjust@redhat.com>
src/osd/OSD.cc

index 1bff914749155b98cd93c574bf1340774632b135..f0401ff0e31d88fdabdf48ed66aaf163d61c38ef 100644 (file)
@@ -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()))
       );
   }