From bf57e20476cf0266840db0edd495368e43f0abb8 Mon Sep 17 00:00:00 2001 From: huangjun Date: Fri, 21 Jun 2019 22:09:39 +0800 Subject: [PATCH] mon: take the mon lock in handle_conf_change Let the finisher thread to do the job, it can hold the mon lock and not hold the config::lock, so can avoid dead lock with mon::tick thread. Fixes: http://tracker.ceph.com/issues/39625 Signed-off-by: huangjun --- src/mon/Monitor.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 3c06dc2610b99..c2d62ed94aa4e 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -550,11 +550,19 @@ void Monitor::handle_conf_change(const ConfigProxy& conf, if (changed.count("mon_health_to_clog") || changed.count("mon_health_to_clog_interval") || changed.count("mon_health_to_clog_tick_interval")) { - health_to_clog_update_conf(changed); + std::set c2(changed); + finisher.queue(new C_MonContext(this, [this, c2](int) { + Mutex::Locker l(lock); + health_to_clog_update_conf(c2); + })); } if (changed.count("mon_scrub_interval")) { - scrub_update_interval(conf->mon_scrub_interval); + int scrub_interval = conf->mon_scrub_interval; + finisher.queue(new C_MonContext(this, [this, scrub_interval](int) { + Mutex::Locker l(lock); + scrub_update_interval(scrub_interval); + })); } }