From: Xiaofei Cui Date: Tue, 3 Mar 2020 07:58:02 +0000 (+0800) Subject: mon: Get session_map_lock before remove_session X-Git-Tag: v15.1.1~133^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c916b8a8156f9855fb74c62508b54308ec5e7b32;p=ceph.git mon: Get session_map_lock before remove_session Get session_map_lock to prevent race. Fixes: https://tracker.ceph.com/issues/44407 Signed-off-by: Xiaofei Cui --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 1f8ef9e8d01fd..b7cb3eaee9133 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -4272,6 +4272,7 @@ void Monitor::_ms_dispatch(Message *m) if (s->item.is_on_list()) { // forwarded messages' sessions are not in the sessions map and // exist only while the op is being handled. + std::lock_guard l(session_map_lock); remove_session(s); } s = nullptr;