diff options
author | Kefu Chai <kchai@redhat.com> | 2016-11-15 07:21:03 +0100 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2016-11-24 15:38:28 +0100 |
commit | cb1cda96713b2ec0f6418c4cbe3d964c2020729c (patch) | |
tree | 2172eb81f79a3a93c1b3d1b74f31bfadeeb0a216 /src/test/objectstore/workload_generator.cc | |
parent | crushtool: s/exit(EXIT_FAILURE)/return EXIT_FAILURE/ (diff) | |
download | ceph-cb1cda96713b2ec0f6418c4cbe3d964c2020729c.tar.xz ceph-cb1cda96713b2ec0f6418c4cbe3d964c2020729c.zip |
common,test: g_ceph_context->put() upon return
prior to this change, global_init() could create a new CephContext
and assign it to g_ceph_context. it's our responsibilty to release
the CephContext explicitly using cct->put() before the application
quits. but sometimes, we fail to do so.
in this change, global_init() will return an intrusive_ptr<CephContext>,
which calls `g_ceph_context->put()` in its dtor. this ensures that
the CephContext is always destroyed before main() returns. so the
log is flushed before _log_exp_length is destroyed.
there are two cases where global_pre_init() is called directly.
- ceph_conf.cc: g_ceph_context->put() will be called by an intrusive_ptr<>
deleter.
- rgw_main.cc: global_init() is called later on on the success code
path, so it will be taken care of.
Fixes: http://tracker.ceph.com/issues/17762
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/test/objectstore/workload_generator.cc')
-rw-r--r-- | src/test/objectstore/workload_generator.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/objectstore/workload_generator.cc b/src/test/objectstore/workload_generator.cc index bbe3c74675e..2c55fb27bc0 100644 --- a/src/test/objectstore/workload_generator.cc +++ b/src/test/objectstore/workload_generator.cc @@ -568,9 +568,9 @@ int main(int argc, const char *argv[]) // def_args.push_back("workload_gen_dir/journal"); argv_to_vec(argc, argv, args); - global_init(&def_args, args, - CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, - CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); + auto cct = global_init(&def_args, args, + CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, + CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); common_init_finish(g_ceph_context); g_ceph_context->_conf->apply_changes(NULL); |