osd: stop MgrClient callbacks on shutdown

Stop the MgrClient callbacks to report PG stats at the
start of shutdown() so that we don't get a callback
during/after we are done shutting down.

Protect the cb update with the MgrClient's lock so that
we don't race with MgrClient::send_report() itself.

Fixes: http://tracker.ceph.com/issues/19638
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-05-01 10:33:36 -04:00
parent 1c9a48cec8
commit 83c45ad6a4
2 changed files with 3 additions and 0 deletions

View File

@ -95,6 +95,7 @@ public:
void set_pgstats_cb(std::function<MPGStats*()> cb_)
{
Mutex::Locker l(lock);
pgstats_cb = cb_;
}

View File

@ -2947,6 +2947,8 @@ int OSD::shutdown()
cct->_conf->set_val("debug_ms", "100");
cct->_conf->apply_changes(NULL);
mgrc.set_pgstats_cb(std::function<MPGStats*()>());
service.start_shutdown();
// stop sending work to pgs. this just prevents any new work in _process