Skip to content

Commit

Permalink
Merge pull request #5887 from Abhishekvrshny/wip-13044-hammer
Browse files Browse the repository at this point in the history
LibCephFS.GetPoolId failure

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Oct 6, 2015
2 parents 79385a8 + 3a50b90 commit 0650862
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/common/ceph_context.cc
Expand Up @@ -399,6 +399,7 @@ CephContext::CephContext(uint32_t module_type_)
_conf(new md_config_t()),
_log(NULL),
_module_type(module_type_),
_crypto_inited(false),
_service_thread(NULL),
_log_obs(NULL),
_admin_socket(NULL),
Expand Down Expand Up @@ -507,7 +508,14 @@ CephContext::~CephContext()

delete _crypto_none;
delete _crypto_aes;
ceph::crypto::shutdown();
if (_crypto_inited)
ceph::crypto::shutdown();
}

void CephContext::init_crypto()
{
ceph::crypto::init(this);
_crypto_inited = true;
}

void CephContext::start_service_thread()
Expand Down
5 changes: 5 additions & 0 deletions src/common/ceph_context.h
Expand Up @@ -77,6 +77,9 @@ class CephContext {
md_config_t *_conf;
ceph::log::Log *_log;

/* init ceph::crypto */
void init_crypto();

/* Start the Ceph Context's service thread */
void start_service_thread();

Expand Down Expand Up @@ -139,6 +142,8 @@ class CephContext {

uint32_t _module_type;

bool _crypto_inited;

/* libcommon service thread.
* SIGHUP wakes this thread, which then reopens logfiles */
friend class CephContextServiceThread;
Expand Down
1 change: 1 addition & 0 deletions src/common/ceph_crypto.cc
Expand Up @@ -76,6 +76,7 @@ void ceph::crypto::init(CephContext *cct)
void ceph::crypto::shutdown()
{
pthread_mutex_lock(&crypto_init_mutex);
assert(crypto_refs > 0);
if (--crypto_refs == 0) {
NSS_ShutdownContext(crypto_context);
crypto_context = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/common/common_init.cc
Expand Up @@ -115,7 +115,7 @@ void complain_about_parse_errors(CephContext *cct,
* same application. */
void common_init_finish(CephContext *cct, int flags)
{
ceph::crypto::init(cct);
cct->init_crypto();

if (!(flags & CINIT_FLAG_NO_DAEMON_ACTIONS))
cct->start_service_thread();
Expand Down

0 comments on commit 0650862

Please sign in to comment.