]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
libceph: add a check in ceph_deinitialize to prevent badness on multiple calls.
authorGreg Farnum <gregf@hq.newdream.net>
Wed, 29 Jul 2009 01:22:00 +0000 (18:22 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Wed, 29 Jul 2009 01:27:32 +0000 (18:27 -0700)
src/client/libceph.cc

index 1144b273ae4a4742ff4938a7bdb104dfd665964e..5aa8d5190faa82c48502e2c45ff1011f7754a5c0 100644 (file)
@@ -21,7 +21,8 @@ static MonClient *monclient = NULL;
 static SimpleMessenger *rank = NULL;
 
 extern "C" int ceph_initialize(int argc, const char **argv)
-{  ceph_client_mutex.Lock();
+{
+  ceph_client_mutex.Lock();
   if (!client_initialized) {
     //create everything to start a client
     vector<const char*> args;
@@ -57,13 +58,15 @@ extern "C" int ceph_initialize(int argc, const char **argv)
 extern "C" void ceph_deinitialize()
 {
   ceph_client_mutex.Lock();
-  client->unmount();
-  client->shutdown();
-  delete client;
-  rank->wait();
-  delete rank;
-  delete monclient;
-  --client_initialized;
+  if(client_initialized) {
+    client->unmount();
+    client->shutdown();
+    delete client;
+    rank->wait();
+    delete rank;
+    delete monclient;
+    --client_initialized;
+  }
   ceph_client_mutex.Unlock();
 }