]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: fix monclient startup issue
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 18 Nov 2009 23:29:56 +0000 (15:29 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 18 Nov 2009 23:29:56 +0000 (15:29 -0800)
src/mon/MonClient.cc
src/mon/MonClient.h

index 8c54b2cfb5b72b3a7f58729b94972cc71c82d731..ee00704825dee5c2bd88e6d189c735bfe6816867 100644 (file)
@@ -263,7 +263,7 @@ int MonClient::authenticate(double timeout)
 {
   Mutex::Locker lock(monc_lock);
 
-  if (clientid >= 0) {
+  if (state == MC_STATE_HAVE_SESSION) {
     dout(5) << "already authenticated" << dendl;;
     return 0;
   }
@@ -272,11 +272,12 @@ int MonClient::authenticate(double timeout)
   if (cur_mon < 0)
     _reopen_session();
 
-  while (clientid < 0 && !authenticate_err)
+  while (state != MC_STATE_HAVE_SESSION && !authenticate_err)
     authenticate_cond.Wait(monc_lock);
 
-  if (clientid >= 0)
-    dout(5) << "authenticate success, client" << clientid << dendl;
+  if (state == MC_STATE_HAVE_SESSION) {
+    dout(5) << "authenticate success, global_id" << global_id << dendl;
+  }
 
   return authenticate_err;
 }
@@ -301,7 +302,7 @@ void MonClient::handle_auth(MAuthReply *m)
     state = MC_STATE_AUTHENTICATING;
   }
   assert(auth);
-  if (m->global_id) {
+  if (m->global_id && m->global_id != global_id) {
     global_id = m->global_id;
     auth->set_global_id(global_id);
     dout(10) << "my global_id is " << m->global_id << dendl;
index 369ee193c89320212138354270e74fb851b9f767..3f6efeeb6626c1c3449c7cfa97e0fd78c4f7cc15 100644 (file)
@@ -92,7 +92,6 @@ private:
 
   // authenticate
 private:
-  client_t clientid;
   Cond map_cond;
   Cond authenticate_cond;
   int authenticate_err;
@@ -217,7 +216,7 @@ public:
     return monmap.size();
   }
 
-  client_t get_global_id() { return clientid; }
+  uint64_t get_global_id() { return global_id; }
 
   void set_messenger(Messenger *m) { messenger = m; }