From cefb1a35ca3dbdf82adc1cc78f9f3083b0602a61 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 30 Sep 2014 17:18:49 -0700 Subject: [PATCH] mon: wait for paxos writes before touching state Fix two other paths where may change the mon state so that we wait for the pending write first. start_election() in particular can be triggered at almost any time if we see an election message from another mon. Signed-off-by: Sage Weil --- src/mon/Monitor.cc | 2 ++ src/mon/Monitor.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 81fc29998971..50b29433f111 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1805,6 +1805,7 @@ void Monitor::handle_probe_reply(MMonProbe *m) void Monitor::join_election() { dout(10) << __func__ << dendl; + wait_for_paxos_write(); _reset(); state = STATE_ELECTING; @@ -1814,6 +1815,7 @@ void Monitor::join_election() void Monitor::start_election() { dout(10) << "start_election" << dendl; + wait_for_paxos_write(); _reset(); state = STATE_ELECTING; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 0601771a36f6..bcf9943faadb 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -557,6 +557,7 @@ public: private: void _reset(); ///< called from bootstrap, start_, or join_election + void wait_for_paxos_write(); public: void bootstrap(); void join_election(); -- 2.47.3