From 9446f769b857334bff634a96fe7ee67954825845 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 30 Jan 2018 09:11:23 -0600 Subject: [PATCH] common/ceph_context: only common_init_finish() once per cct Signed-off-by: Sage Weil --- src/common/ceph_context.h | 2 ++ src/common/common_init.cc | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 94179c133d1..7ac7c32de71 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -71,6 +71,8 @@ public: CephContext(CephContext&&) = delete; CephContext& operator =(CephContext&&) = delete; + bool _finished = false; + // ref count! private: ~CephContext(); diff --git a/src/common/common_init.cc b/src/common/common_init.cc index 3042b612940..b365ba67ac7 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -90,6 +90,11 @@ void complain_about_parse_errors(CephContext *cct, * same application. */ void common_init_finish(CephContext *cct) { + // only do this once per cct + if (cct->_finished) { + return; + } + cct->_finished = true; cct->init_crypto(); ZTracer::ztrace_init(); -- 2.39.5