]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fixed unnamed entity naming, parallel synclient mounting
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Sat, 25 Aug 2007 21:04:56 +0000 (21:04 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Sat, 25 Aug 2007 21:04:56 +0000 (21:04 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1694 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/client/Client.cc
trunk/ceph/mds/MDS.cc
trunk/ceph/mon/ClientMonitor.cc
trunk/ceph/mon/Monitor.cc
trunk/ceph/mon/Monitor.h
trunk/ceph/msg/SimpleMessenger.cc

index 90dbc8df4823a7c4ca6e16736d7ca5e8b1a61d85..b287950859b628f467f1ae9ab1b8edec579a9a24 100644 (file)
@@ -939,7 +939,6 @@ void Client::handle_mds_map(MMDSMap* m)
     assert(m->get_source().is_mon());
     whoami = m->get_dest().num();
     dout(1) << "handle_mds_map i am now " << m->get_dest() << dendl;
-    messenger->reset_myname(m->get_dest());
     
     mount_cond.Signal();  // mount might be waiting for this.
   } 
@@ -1335,10 +1334,12 @@ void Client::_try_mount()
                                           client_instance_this_process), 
                          monmap->get_inst(mon));
 
-  // schedule timeout
-  assert(mount_timeout_event == 0);
-  mount_timeout_event = new C_MountTimeout(this);
-  timer.add_event_after(g_conf.client_mount_timeout, mount_timeout_event);
+  // schedule timeout?
+  if (g_conf.num_client <= 1) {  // don't do this if we have multiple instances in our process!
+    assert(mount_timeout_event == 0);
+    mount_timeout_event = new C_MountTimeout(this);
+    timer.add_event_after(g_conf.client_mount_timeout, mount_timeout_event);
+  }
 }
 
 void Client::_mount_timeout()
@@ -1360,9 +1361,11 @@ int Client::mount()
         !osdmap || 
         osdmap->get_epoch() == 0)
     mount_cond.Wait(client_lock);
-
-  timer.cancel_event(mount_timeout_event);
-  mount_timeout_event = 0;
+  
+  if (mount_timeout_event) {  // will be false if g_conf.num_client > 1.. see _try_mount above
+    timer.cancel_event(mount_timeout_event);
+    mount_timeout_event = 0;
+  }
   
   mounted = true;
 
index b45ff0444e74dfad7052a69fff2c321cf2cfe198..d85b6fe99420493923cccbf940620b1679cd4263 100644 (file)
@@ -512,8 +512,6 @@ void MDS::handle_mds_map(MMDSMap *m)
   }
   if (oldwhoami != whoami) {
     // update messenger.
-    messenger->reset_myname(MSG_ADDR_MDS(whoami));
-
     reopen_logger();
     dout(1) << "handle_mds_map i am now mds" << whoami
            << " incarnation " << mdsmap->get_inc(whoami)
index 220f81d548cbcbf0ae6dd8b3d5b7fd53f364151d..0f60eac46c7acbd13d41d58e8084998eed63db5c 100644 (file)
@@ -233,7 +233,8 @@ void ClientMonitor::_unmounted(MClientUnmount *m)
   if (mon->is_leader() &&
       client_map.version > 1 &&
       client_map.client_addr.empty() && 
-      g_conf.mon_stop_on_last_unmount) {
+      g_conf.mon_stop_on_last_unmount &&
+      !mon->is_stopping()) {
     dout(1) << "last client unmounted" << dendl;
     mon->do_stop();
   }
index 7400f0fc107de374e4db5ca7c1260eb9e54c754a..873d6680064b01c1d1024086410a8baca1532e67 100644 (file)
@@ -232,6 +232,7 @@ void Monitor::handle_command(MMonCommand *m)
 void Monitor::do_stop()
 {
   dout(0) << "do_stop -- shutting down" << dendl;
+  stopping = true;
   mdsmon->do_stop();
 }
 
index ba23175a1dad79cb145e7d7052134aa26eaa3606..bd278a209230877243b331290d4857da07ee0d40 100644 (file)
@@ -58,11 +58,13 @@ private:
   const static int STATE_LEADER =   1;
   const static int STATE_PEON =     2;
   int state;
+  bool stopping;
 
 public:
   bool is_starting() { return state == STATE_STARTING; }
   bool is_leader() { return state == STATE_LEADER; }
   bool is_peon() { return state == STATE_PEON; }
+  bool is_stopping() { return stopping; }
 
 
   // -- elector --
@@ -121,7 +123,7 @@ public:
     timer(lock), tick_timer(0),
     store(0),
 
-    state(STATE_STARTING),
+    state(STATE_STARTING), stopping(false),
 
     elector(this, w),
     mon_epoch(0), 
index 35182d2b4f675a5c4932fa289fb319dcad548180..ea011bb20f1b45dd76602cfbe4218bf0431f95fb 100644 (file)
@@ -419,7 +419,10 @@ void Rank::Pipe::reader()
          entity = rank.local[m->get_dest()];
        } else {
          entity = rank.find_unnamed(m->get_dest());
-         if (!entity) {
+         if (entity) {
+           dout(3) << "pipe(" << peer_addr << ' ' << this << ").reader blessing " << m->get_dest() << dendl;
+           entity->reset_myname(m->get_dest());
+         } else {
            if (rank.stopped.count(m->get_dest())) {
              // ignore it
            } else {
@@ -432,7 +435,7 @@ void Rank::Pipe::reader()
     }
     rank.lock.Unlock();
     
-    if (entity) 
+    if (entity)
       entity->queue_message(m);        // queue
   }