]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/MDSUtility: fix crash on bad config
authorJohn Spray <john.spray@inktank.com>
Tue, 20 May 2014 10:00:52 +0000 (11:00 +0100)
committerJohn Spray <john.spray@inktank.com>
Tue, 20 May 2014 13:43:54 +0000 (14:43 +0100)
Was calling messenger destructor before
calling shutdown in case where config
was bad, e.g. in vstart without "-c" flag.

Signed-off-by: John Spray <john.spray@inktank.com>
src/tools/cephfs/MDSUtility.cc

index 5633c929bd472de974d7bd7eb38816ebc6dd67ff..4d6176aced056203eb93fa44e127f84c9ec1c951 100644 (file)
@@ -54,8 +54,11 @@ int MDSUtility::init()
   messenger->start();
 
   // Initialize MonClient
-  if (monc->build_initial_monmap() < 0)
+  if (monc->build_initial_monmap() < 0) {
+    messenger->shutdown();
+    messenger->wait();
     return -1;
+  }
 
   monc->set_want_keys(CEPH_ENTITY_TYPE_MON|CEPH_ENTITY_TYPE_OSD|CEPH_ENTITY_TYPE_MDS);
   monc->set_messenger(messenger);
@@ -63,6 +66,9 @@ int MDSUtility::init()
   r = monc->authenticate();
   if (r < 0) {
     derr << "Authentication failed, did you specify an MDS ID with a valid keyring?" << dendl;
+    monc->shutdown();
+    messenger->shutdown();
+    messenger->wait();
     return r;
   }