]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: fix shutdown race 8335/head
authorSage Weil <sage@redhat.com>
Mon, 28 Mar 2016 14:33:53 +0000 (10:33 -0400)
committerSage Weil <sage@redhat.com>
Mon, 28 Mar 2016 14:33:53 +0000 (10:33 -0400)
While we are shutting down, we should drop all subsequent mon
messages.  Currently it is possible to finish the authentication
sequence *while* we are shutting down, such that a subsequent
attempt to authenticate succeeds.

Fix this by resetting cur_con early in the sequence, as this
makes us drop all incoming messages.

Fixes: http://tracker.ceph.com/issues/13992
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonClient.cc

index dc1ec6c4a7b0d99aeace3551a5062c28b926c2a6..2ab6174e3622425b69a0cbc9a01b629ac9976b6b 100644 (file)
@@ -426,6 +426,11 @@ void MonClient::shutdown()
     waiting_for_session.pop_front();
   }
 
+  if (cur_con)
+    cur_con->mark_down();
+  cur_con.reset(NULL);
+  cur_mon.clear();
+
   monc_lock.Unlock();
 
   if (initialized) {
@@ -434,11 +439,6 @@ void MonClient::shutdown()
   monc_lock.Lock();
   timer.shutdown();
 
-  if (cur_con)
-    cur_con->mark_down();
-  cur_con.reset(NULL);
-  cur_mon.clear();
-
   monc_lock.Unlock();
 }