Skip to content

Commit

Permalink
mon/MonClient: fix shutdown race
Browse files Browse the repository at this point in the history
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 5b44a34)
  • Loading branch information
liewegas authored and smithfarm committed Apr 28, 2016
1 parent e219e85 commit 7b3f1da
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/mon/MonClient.cc
Expand Up @@ -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) {
Expand All @@ -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();
}

Expand Down

0 comments on commit 7b3f1da

Please sign in to comment.