]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs: fix for #4068
authorJoe Buck <jbbuck@gmail.com>
Sun, 10 Feb 2013 02:48:57 +0000 (18:48 -0800)
committerJoe Buck <jbbuck@gmail.com>
Mon, 11 Feb 2013 17:57:36 +0000 (09:57 -0800)
If client->init() fails in mount, then client->shutdown()
should not be called. This patch uses a bool to ensure
that shutdown is only called if init() succeeds.

Signed-off-by: Joe Buck <jbbuck@gmail.com>
Reviewed-by: Sam Lang <sam.lang@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/libcephfs.cc

index 6f3c04a6d0aa274fadfe951a5d8e2a371173fc4f..8ad01f1abfdecbbb4cd773a4e5920b25d3d1d4d9 100644 (file)
@@ -37,6 +37,7 @@ public:
   ceph_mount_info(uint64_t msgr_nonce_, CephContext *cct_)
     : msgr_nonce(msgr_nonce_),
       mounted(false),
+      inited(false),
       client(NULL),
       monclient(NULL),
       messenger(NULL),
@@ -95,6 +96,8 @@ public:
     if (ret)
       goto fail;
 
+    inited = true;
+
     ret = client->mount(mount_root);
     if (ret)
       goto fail;
@@ -121,7 +124,7 @@ public:
       client->unmount();
       mounted = false;
     }
-    if (client) {
+    if (inited) {
       client->shutdown();
     }
     if (messenger) {
@@ -201,6 +204,7 @@ public:
 private:
   uint64_t msgr_nonce;
   bool mounted;
+  bool inited;
   Client *client;
   MonClient *monclient;
   Messenger *messenger;