From: Joe Buck Date: Sun, 10 Feb 2013 02:48:57 +0000 (-0800) Subject: libcephfs: fix for #4068 X-Git-Tag: v0.58~108 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=133295ed001a950e3296f4e88a916ab2405be0cc;p=ceph.git libcephfs: fix for #4068 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 Reviewed-by: Sam Lang Reviewed-by: Sage Weil --- diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 6f3c04a6d0aa..8ad01f1abfde 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -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;