From 8371680bab780933944dffd02246c73b17d6d930 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 19 Jul 2013 16:36:01 -0700 Subject: [PATCH] mon: OSDMonitor: only thrash and propose if we are the leader 'thrash_map' is only set if we are the leader, so we would thrash and propose the pending value if we are the leader. However, we should keep the 'is_leader()' check not only for clarity's sake (an unfamiliar reader may cry OMGBUG, prompting to a patch much like this), but also because we may lose a subsequent election and become a peon instead, while still holding a 'thrash_map' value > 0 -- and we really don't want to propose while being a peon. [This is a rebased version of 5eac38797d9eb5a59fcff1d81571cff7a2f10e66, complete with the typo fix in d656aed599ee754646e16386ce5a4ab0117f2d6e.] Signed-off-by: Joao Eduardo Luis Reviewed-by: Sage Weil --- src/mon/OSDMonitor.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 82ff36d8469cd..c41a59fa14853 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -297,8 +297,14 @@ void OSDMonitor::on_active() { update_logger(); - if (thrash_map && thrash()) - propose_pending(); + if (thrash_map) { + if (mon->is_leader()) { + if (thrash()) + propose_pending(); + } else { + thrash_map = 0; + } + } if (mon->is_leader()) mon->clog.info() << "osdmap " << osdmap << "\n"; -- 2.39.5