mgr/MgrStandby: prevent use-after-free on just-shut-down Mgr

Fixes: http://tracker.ceph.com/issues/19595
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-05-25 18:25:27 -04:00
parent 25b8e0f63f
commit 890f482568
2 changed files with 3 additions and 2 deletions

View File

@ -258,8 +258,9 @@ bool MgrStandby::ms_dispatch(Message *m)
default:
if (active_mgr) {
auto am = active_mgr;
lock.Unlock();
active_mgr->ms_dispatch(m);
am->ms_dispatch(m);
lock.Lock();
} else {
return false;

View File

@ -53,7 +53,7 @@ protected:
Mutex lock;
SafeTimer timer;
std::unique_ptr<Mgr> active_mgr;
std::shared_ptr<Mgr> active_mgr;
std::string state_str();