]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Get session_map_lock before remove_session 34677/head
authorXiaofei Cui <cuixiaofei@sangfor.com.cn>
Tue, 3 Mar 2020 07:58:02 +0000 (15:58 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Wed, 22 Apr 2020 10:03:08 +0000 (10:03 +0000)
Get session_map_lock to prevent race.

Fixes: https://tracker.ceph.com/issues/44407
Signed-off-by: Xiaofei Cui <cuixiaofei@sangfor.com.cn>
(cherry picked from commit c916b8a8156f9855fb74c62508b54308ec5e7b32)

src/mon/Monitor.cc

index 2e129c3b0aa6ad340b828263488e8e2f61f256b0..39f67000df7d8137244727efb481a8cf8cbf9568 100644 (file)
@@ -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;