]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: open_root only after up:active
authorSage Weil <sage@newdream.net>
Mon, 3 Aug 2009 21:25:35 +0000 (14:25 -0700)
committerSage Weil <sage@newdream.net>
Tue, 4 Aug 2009 22:33:35 +0000 (15:33 -0700)
Otherwise our lock states get totally out of whack.

src/mds/MDS.cc
src/mds/MDS.h

index e5e4d940a95e7feecec3edc83848d74ff2ba4ed6..62ab6e4988467531add296c210cc873888d7bc55 100644 (file)
@@ -121,7 +121,7 @@ MDS::MDS(const char *n, Messenger *m, MonClient *mc) :
 
   req_rate = 0;
 
-  want_state = state = MDSMap::STATE_BOOT;
+  last_state = want_state = state = MDSMap::STATE_BOOT;
 
   logger = 0;
   mlogger = 0;
@@ -613,6 +613,9 @@ void MDS::handle_mds_map(MMDSMap *m)
   state = mdsmap->get_state(addr);
   dout(10) << "map says i am " << addr << " mds" << whoami << " state " << ceph_mds_state_name(state) << dendl;
 
+  if (state != oldstate)
+    last_state = oldstate;
+
   if (state == MDSMap::STATE_STANDBY) {
     want_state = state = MDSMap::STATE_STANDBY;
     dout(1) << "handle_mds_map standby" << dendl;
@@ -836,8 +839,6 @@ void MDS::creating_done()
 
   // start new segment
   mdlog->start_new_segment(0);
-
-  mdcache->open_root();
 }
 
 
@@ -1032,6 +1033,10 @@ void MDS::clientreplay_done()
 void MDS::active_start()
 {
   dout(1) << "active_start" << dendl;
+
+  if (last_state == MDSMap::STATE_CREATING)
+    mdcache->open_root();
+
   mdcache->clean_open_file_lists();
   finish_contexts(waiting_for_replay);  // kick waiters
   finish_contexts(waiting_for_active);  // kick waiters
index 7ab30c40e287de38d4f4cd8bc9beede3096e0614..57a1d20021f4624a9b69436a466b817203adff8d 100644 (file)
@@ -180,6 +180,7 @@ class MDS : public Dispatcher {
 
  protected:
   // -- MDS state --
+  int last_state;
   int state;         // my confirmed state
   int want_state;    // the state i want