From: Sage Weil Date: Mon, 28 Mar 2016 14:33:53 +0000 (-0400) Subject: mon/MonClient: fix shutdown race X-Git-Tag: v0.94.8~25^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b3f1da0ab7f60705b6bc802ddb1bfbce10c8738;p=ceph.git mon/MonClient: fix shutdown race 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 (cherry picked from commit 5b44a348bfe4978446bbc7acf58eb8f60a47c965) --- diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 9c0f01f7daef..07d97810dc42 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -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(); }