]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor: drop pg temp from sources other than the current primary 9893/head
authorSamuel Just <sjust@redhat.com>
Thu, 2 Jun 2016 17:43:17 +0000 (10:43 -0700)
committerVicente Cheng <freeze.bilsted@gmail.com>
Mon, 18 Jul 2016 03:08:28 +0000 (11:08 +0800)
Fixes: http://tracker.ceph.com/issues/16127
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 1a07123c38e3fecb3fb2e43bbbae962d8411d287)

change:
            use NULL to replace the nullptr because we don't have C++11

src/mon/OSDMonitor.cc

index f12f753b2222adb18790fb1718632526f51084bd..1f08548fa54c601d4a684d76e6d4093a743eb8b8 100644 (file)
@@ -2028,6 +2028,21 @@ bool OSDMonitor::preprocess_pgtemp(MOSDPGTemp *m)
       continue;
     }
 
+    int acting_primary = -1;
+    osdmap.pg_to_up_acting_osds(
+      p->first, NULL, NULL, NULL, &acting_primary);
+    if (acting_primary != from) {
+      /* If the source isn't the primary based on the current osdmap, we know
+       * that the interval changed and that we can discard this message.
+       * Indeed, we must do so to avoid 16127 since we can't otherwise determine
+       * which of two pg temp mappings on the same pg is more recent.
+       */
+      dout(10) << __func__ << " ignore " << p->first << " -> " << p->second
+              << ": primary has changed" << dendl;
+      ignore_cnt++;
+      continue;
+    }
+
     // removal?
     if (p->second.empty() && (osdmap.pg_temp->count(p->first) ||
                              osdmap.primary_temp->count(p->first)))