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: v14.2.10~99^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=23a6011010832151340313848cd2adc2c78b910d;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 (cherry picked from commit c916b8a8156f9855fb74c62508b54308ec5e7b32) --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 2e129c3b0aa6..39f67000df7d 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -4355,6 +4355,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;