]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: behave if shutdown is called twice
authorSage Weil <sage.weil@dreamhost.com>
Mon, 24 Oct 2011 04:07:39 +0000 (21:07 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Mon, 24 Oct 2011 04:07:39 +0000 (21:07 -0700)
On failure, we shut ourselves down.  If the caller calls shutdown again,
don't crash.

Fixes: #1650
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/librados.cc

index 3baf43fdd67eafc8c46ef5f04e7762662dd83ab9..1b43f7637b623875b14f9abbc1953ff253144313 100644 (file)
@@ -989,11 +989,15 @@ int librados::RadosClient::connect()
 void librados::RadosClient::shutdown()
 {
   lock.Lock();
+  if (state == DISCONNECTED) {
+    lock.Unlock();
+    return;
+  }
+  state = DISCONNECTED;
   monclient.shutdown();
   if (objecter)
     objecter->shutdown();
   timer.shutdown();
-  state = DISCONNECTED;
   lock.Unlock();
   if (messenger) {
     messenger->shutdown();