]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: only delete mds on clean shutdown
authorSage Weil <sage@newdream.net>
Mon, 20 Apr 2009 23:14:52 +0000 (16:14 -0700)
committerSage Weil <sage@newdream.net>
Mon, 20 Apr 2009 23:14:52 +0000 (16:14 -0700)
This avoids bad asserts on suicide, but still lets us find memory leaks
on clean shutdowns.

src/cmds.cc
src/mds/MDS.cc

index 7b929d164ccd1abd1e6e2c4218dabf10f4a69959..a1603dd3171424a43c1f7d119d1b9c0fb09c1b70 100644 (file)
@@ -97,8 +97,10 @@ int main(int argc, const char **argv)
   mds->mds_lock.Lock();
   mds->mds_lock.Unlock();
 
-  // done
-  delete mds;
+  // only delete if it was a clean shutdown (to aid memory leak
+  // detection, etc.).  don't bother if it was a suicide.
+  if (mds->is_stopped())
+    delete mds;
 
   // cd on exit, so that gmon.out (if any) goes into a separate directory for each node.
   char s[20];
index f03ed4d0f0ca7c403498ca16c16f9d0401d1d32a..a4f17038f12267f88ebff6c0536578db2f701daf 100644 (file)
@@ -1056,8 +1056,13 @@ void MDS::stopping_done()
 
 void MDS::suicide()
 {
-  dout(1) << "suicide" << dendl;
-  state = MDSMap::STATE_STOPPED;  // well, maybe failed, but close enough.
+  if (want_state == MDSMap::STATE_STOPPED)
+    state = want_state;
+  else
+    state = CEPH_MDS_STATE_DNE; // whatever.
+
+  dout(1) << "suicide.  wanted " << ceph_mds_state_name(want_state)
+         << ", now " << ceph_mds_state_name(state) << dendl;
 
   // stop timers
   if (beacon_killer) {