]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Get session_map_lock before remove_session 33682/head
authorXiaofei Cui <cuixiaofei@sangfor.com.cn>
Tue, 3 Mar 2020 07:58:02 +0000 (15:58 +0800)
committerXiaofei Cui <cuixiaofei@sangfor.com.cn>
Wed, 4 Mar 2020 06:12:49 +0000 (14:12 +0800)
Get session_map_lock to prevent race.

Fixes: https://tracker.ceph.com/issues/44407
Signed-off-by: Xiaofei Cui <cuixiaofei@sangfor.com.cn>
src/mon/Monitor.cc

index 1f8ef9e8d01fd4a7fa1be33ec85c72fe59211fb4..b7cb3eaee91337251b16eae6fca9df2d1a037a2e 100644 (file)
@@ -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;