]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: fix shutdown race 8806/head
authorSage Weil <sage@redhat.com>
Mon, 28 Mar 2016 14:33:53 +0000 (10:33 -0400)
committerNathan Cutler <ncutler@suse.com>
Thu, 28 Apr 2016 08:57:48 +0000 (10:57 +0200)
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>
(cherry picked from commit 5b44a348bfe4978446bbc7acf58eb8f60a47c965)

src/mon/MonClient.cc

index 9c0f01f7daef937ebab2bb13f9614c2d7d99e0e3..07d97810dc4253576c23cd6dad4f99a0c2c995c6 100644 (file)
@@ -410,6 +410,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) {
@@ -418,11 +423,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();
 }