@@ -550,28 +550,35 @@ bool MDSMonitor::prepare_update(MonOpRequestRef op)
550550 auto m = op->get_req <PaxosServiceMessage>();
551551 dout (7 ) << " prepare_update " << *m << dendl;
552552
553- switch (m->get_type ()) {
554-
555- case MSG_MDS_BEACON:
556- return prepare_beacon (op);
553+ bool r = false ;
557554
558- case MSG_MON_COMMAND:
559- try {
560- return prepare_command (op);
561- } catch (const bad_cmd_get& e) {
562- bufferlist bl;
563- mon.reply_command (op, -EINVAL, e.what (), bl, get_last_committed ());
564- return false ; /* nothing to propose */
565- }
555+ /* batch any changes to pending with any changes to osdmap */
556+ paxos.plug ();
566557
567- case MSG_MDS_OFFLOAD_TARGETS:
568- return prepare_offload_targets (op);
569-
570- default :
571- ceph_abort ();
558+ switch (m->get_type ()) {
559+ case MSG_MDS_BEACON:
560+ r = prepare_beacon (op);
561+ break ;
562+ case MSG_MON_COMMAND:
563+ try {
564+ r = prepare_command (op);
565+ } catch (const bad_cmd_get& e) {
566+ bufferlist bl;
567+ mon.reply_command (op, -EINVAL, e.what (), bl, get_last_committed ());
568+ r = false ;
569+ }
570+ break ;
571+ case MSG_MDS_OFFLOAD_TARGETS:
572+ r = prepare_offload_targets (op);
573+ break ;
574+ default :
575+ ceph_abort ();
576+ break ;
572577 }
573578
574- return false ; /* nothing to propose! */
579+ paxos.unplug ();
580+
581+ return r;
575582}
576583
577584bool MDSMonitor::prepare_beacon (MonOpRequestRef op)
@@ -804,6 +811,7 @@ bool MDSMonitor::prepare_beacon(MonOpRequestRef op)
804811 last_beacon.erase (followergid);
805812 }
806813 request_proposal (mon.osdmon ());
814+ force_immediate_propose ();
807815 pending.damaged (rankgid, blocklist_epoch);
808816 last_beacon.erase (rankgid);
809817
@@ -1277,6 +1285,8 @@ bool MDSMonitor::fail_mds_gid(FSMap &fsmap, mds_gid_t gid)
12771285 utime_t until = ceph_clock_now ();
12781286 until += g_conf ().get_val <double >(" mon_mds_blocklist_interval" );
12791287 blocklist_epoch = mon.osdmon ()->blocklist (info.addrs , until);
1288+ /* do not delay when we are evicting an MDS */
1289+ force_immediate_propose ();
12801290 }
12811291
12821292 fsmap.erase (gid, blocklist_epoch);
@@ -1386,7 +1396,6 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op)
13861396
13871397 auto &pending = get_pending_fsmap_writeable ();
13881398
1389- bool batched_propose = false ;
13901399 for (const auto &h : handlers) {
13911400 r = h->can_handle (prefix, op, pending, cmdmap, ss);
13921401 if (r == 1 ) {
@@ -1397,14 +1406,7 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op)
13971406 goto out;
13981407 }
13991408
1400- batched_propose = h->batched_propose ();
1401- if (batched_propose) {
1402- paxos.plug ();
1403- }
14041409 r = h->handle (&mon, pending, op, cmdmap, ss);
1405- if (batched_propose) {
1406- paxos.unplug ();
1407- }
14081410
14091411 if (r == -EAGAIN) {
14101412 // message has been enqueued for retry; return.
@@ -1445,9 +1447,6 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op)
14451447 // success.. delay reply
14461448 wait_for_finished_proposal (op, new Monitor::C_Command (mon, op, r, rs,
14471449 get_last_committed () + 1 ));
1448- if (batched_propose) {
1449- force_immediate_propose ();
1450- }
14511450 return true ;
14521451 } else {
14531452 // reply immediately
@@ -2319,6 +2318,9 @@ void MDSMonitor::tick()
23192318
23202319 auto &pending = get_pending_fsmap_writeable ();
23212320
2321+ /* batch any changes to pending with any changes to osdmap */
2322+ paxos.plug ();
2323+
23222324 bool do_propose = false ;
23232325 bool propose_osdmap = false ;
23242326
@@ -2374,6 +2376,9 @@ void MDSMonitor::tick()
23742376 request_proposal (mon.osdmon ());
23752377 }
23762378
2379+ /* allow MDSMonitor::propose_pending() to push the proposal through */
2380+ paxos.unplug ();
2381+
23772382 if (do_propose) {
23782383 propose_pending ();
23792384 }
0 commit comments