From: Sage Weil Date: Wed, 1 Oct 2014 00:15:25 +0000 (-0700) Subject: mon: move paxos write wait into a helper X-Git-Tag: v0.87~40^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4072ef782e474a03e888f52ad4cc1f1eb2653f50;p=ceph.git mon: move paxos write wait into a helper Avoid duplicated code. Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 84c66466e08b..8f0b67a96b72 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -865,14 +865,7 @@ void Monitor::shutdown() lock.Lock(); state = STATE_SHUTDOWN; - - if (paxos->is_writing() || paxos->is_writing_previous()) { - dout(10) << __func__ << " flushing" << dendl; - lock.Unlock(); - store->flush(); - lock.Lock(); - dout(10) << __func__ << " flushed" << dendl; - } + wait_for_paxos_write(); if (admin_hook) { AdminSocket* admin_socket = cct->get_admin_socket(); @@ -919,15 +912,21 @@ void Monitor::shutdown() messenger->shutdown(); // last thing! ceph_mon.cc will delete mon. } -void Monitor::bootstrap() +void Monitor::wait_for_paxos_write() { if (paxos->is_writing() || paxos->is_writing_previous()) { - dout(10) << "bootstrap flushing pending write" << dendl; + dout(10) << __func__ << " flushing pending write" << dendl; lock.Unlock(); store->flush(); lock.Lock(); + dout(10) << __func__ << " flushed pending write" << dendl; } +} + +void Monitor::bootstrap() +{ dout(10) << "bootstrap" << dendl; + wait_for_paxos_write(); sync_reset_requester(); unregister_cluster_logger(); @@ -2553,11 +2552,7 @@ void Monitor::handle_command(MMonCommand *m) } if (prefix == "scrub") { - while (paxos->is_writing() || paxos->is_writing_previous()) { - lock.Unlock(); - store->flush(); - lock.Lock(); - } + wait_for_paxos_write(); if (is_leader()) { int r = scrub(); reply_command(m, r, "", rdata, 0);