From 805c6d5d142a21ca525f4d7495dc89414593773f Mon Sep 17 00:00:00 2001 From: sageweil Date: Sat, 25 Aug 2007 21:04:56 +0000 Subject: [PATCH] fixed unnamed entity naming, parallel synclient mounting git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1694 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/client/Client.cc | 19 +++++++++++-------- trunk/ceph/mds/MDS.cc | 2 -- trunk/ceph/mon/ClientMonitor.cc | 3 ++- trunk/ceph/mon/Monitor.cc | 1 + trunk/ceph/mon/Monitor.h | 4 +++- trunk/ceph/msg/SimpleMessenger.cc | 7 +++++-- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/trunk/ceph/client/Client.cc b/trunk/ceph/client/Client.cc index 90dbc8df4823a..b287950859b62 100644 --- a/trunk/ceph/client/Client.cc +++ b/trunk/ceph/client/Client.cc @@ -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; diff --git a/trunk/ceph/mds/MDS.cc b/trunk/ceph/mds/MDS.cc index b45ff0444e74d..d85b6fe994204 100644 --- a/trunk/ceph/mds/MDS.cc +++ b/trunk/ceph/mds/MDS.cc @@ -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) diff --git a/trunk/ceph/mon/ClientMonitor.cc b/trunk/ceph/mon/ClientMonitor.cc index 220f81d548cbc..0f60eac46c7ac 100644 --- a/trunk/ceph/mon/ClientMonitor.cc +++ b/trunk/ceph/mon/ClientMonitor.cc @@ -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(); } diff --git a/trunk/ceph/mon/Monitor.cc b/trunk/ceph/mon/Monitor.cc index 7400f0fc107de..873d6680064b0 100644 --- a/trunk/ceph/mon/Monitor.cc +++ b/trunk/ceph/mon/Monitor.cc @@ -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(); } diff --git a/trunk/ceph/mon/Monitor.h b/trunk/ceph/mon/Monitor.h index ba23175a1dad7..bd278a2092308 100644 --- a/trunk/ceph/mon/Monitor.h +++ b/trunk/ceph/mon/Monitor.h @@ -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), diff --git a/trunk/ceph/msg/SimpleMessenger.cc b/trunk/ceph/msg/SimpleMessenger.cc index 35182d2b4f675..ea011bb20f1b4 100644 --- a/trunk/ceph/msg/SimpleMessenger.cc +++ b/trunk/ceph/msg/SimpleMessenger.cc @@ -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 } -- 2.39.5