Skip to content

Commit 3291f39

Browse files
committed
mds: set dispatcher order
This tries to preserve existing order but uses priorities to make it explicit and robust to future dispatchers being added. Except: - The beacon and metrics dispatcher have the highest priorities. This is to ensure we process these messages before trying to acquire any expensive locks (like mds_lock). - The monc dispatcher also has a relatively high priority for the same reasons. This change affects other daemons which may have ordered a dispatcher ahead of the monc but I cannot think of a legitimate reason to nor do I see an instance of it. Fixes: 7fc04be Signed-off-by: Patrick Donnelly <[email protected]>
1 parent 7fc2a65 commit 3291f39

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/mds/MDSDaemon.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,10 @@ int MDSDaemon::init()
570570
dout(10) << sizeof(Capability) << "\tCapability" << dendl;
571571
dout(10) << sizeof(xlist<void*>::item) << "\txlist<>::item" << dendl;
572572

573-
messenger->add_dispatcher_tail(&beacon);
574-
messenger->add_dispatcher_tail(this);
573+
// Ensure beacons are processed ahead of most other dispatchers.
574+
messenger->add_dispatcher_head(&beacon, Dispatcher::PRIORITY_HIGH);
575+
// order last as MDSDaemon::ms_dispatch2 first acquires the mds_lock
576+
messenger->add_dispatcher_head(this, Dispatcher::PRIORITY_LOW);
575577

576578
// init monc
577579
monc->set_messenger(messenger);

src/mds/MDSRank.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ MDSRank::~MDSRank()
610610
void MDSRankDispatcher::init()
611611
{
612612
objecter->init();
613-
messenger->add_dispatcher_head(objecter);
613+
messenger->add_dispatcher_tail(objecter); // the default priority
614614

615615
objecter->start();
616616

@@ -2137,7 +2137,7 @@ void MDSRank::active_start()
21372137

21382138
dout(10) << __func__ << ": initializing metrics handler" << dendl;
21392139
metrics_handler.init();
2140-
messenger->add_dispatcher_tail(&metrics_handler);
2140+
messenger->add_dispatcher_tail(&metrics_handler, Dispatcher::PRIORITY_HIGH);
21412141

21422142
// metric aggregation is solely done by rank 0
21432143
if (is_rank0()) {

src/mon/MonClient.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ int MonClient::get_monmap_and_config()
131131
messenger = Messenger::create_client_messenger(
132132
cct, "temp_mon_client");
133133
ceph_assert(messenger);
134-
messenger->add_dispatcher_head(this);
134+
messenger->add_dispatcher_head(this, Dispatcher::PRIORITY_HIGH);
135135
messenger->start();
136136
auto shutdown_msgr = make_scope_guard([this] {
137137
messenger->shutdown();
@@ -265,7 +265,7 @@ int MonClient::ping_monitor(const string &mon_id, string *result_reply)
265265
result_reply);
266266

267267
Messenger *smsgr = Messenger::create_client_messenger(cct, "temp_ping_client");
268-
smsgr->add_dispatcher_head(pinger);
268+
smsgr->add_dispatcher_head(pinger, Dispatcher::PRIORITY_HIGH);
269269
smsgr->set_auth_client(pinger);
270270
smsgr->start();
271271

@@ -512,7 +512,7 @@ int MonClient::init()
512512
initialized = true;
513513

514514
messenger->set_auth_client(this);
515-
messenger->add_dispatcher_head(this);
515+
messenger->add_dispatcher_head(this, Dispatcher::PRIORITY_HIGH);
516516

517517
timer.init();
518518
schedule_tick();

0 commit comments

Comments
 (0)