From 1a07123c38e3fecb3fb2e43bbbae962d8411d287 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 2 Jun 2016 10:43:17 -0700 Subject: [PATCH] OSDMonitor: drop pg temp from sources other than the current primary Fixes: http://tracker.ceph.com/issues/16127 Signed-off-by: Samuel Just --- src/mon/OSDMonitor.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index c18583cb65d30..85d0aca1c193e 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2328,6 +2328,21 @@ bool OSDMonitor::preprocess_pgtemp(MonOpRequestRef op) continue; } + int acting_primary = -1; + osdmap.pg_to_up_acting_osds( + p->first, nullptr, nullptr, nullptr, &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)))