From 02a92360171240be9a66d1939c019b3427ed825d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 14 May 2018 12:56:59 -0500 Subject: [PATCH] mon/MonClient: set configs via finisher The config observers may want to take locks that are ordered relative to monc_lock. We could simply drop monc_lock for this call, but that would implicitly rely on a single-threaded dispatch to avoid having two incoming MConfig messages get reordered. Explicitly putting it on a finisher is safer. Note that we adjust the get_monmap_and_config() to start, drain, and stop the finisher to ensure we have incoming config processed and applied before returning. Fixes: http://tracker.ceph.com/issues/24118 Signed-off-by: Sage Weil --- src/mon/MonClient.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 5f31182a761..1ad9e50647b 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -374,8 +374,10 @@ void MonClient::handle_monmap(MMonMap *m) void MonClient::handle_config(MConfig *m) { ldout(cct,10) << __func__ << " " << *m << dendl; - cct->_conf->set_mon_vals(cct, m->config, config_cb); - m->put(); + finisher.queue(new FunctionContext([this, m](int r) { + cct->_conf->set_mon_vals(cct, m->config, config_cb); + m->put(); + })); got_config = true; map_cond.Signal(); } -- 2.39.5