summaryrefslogtreecommitdiffstats
path: root/src/test/filestore
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2016-11-15 07:21:03 +0100
committerKefu Chai <kchai@redhat.com>2016-11-24 15:38:28 +0100
commitcb1cda96713b2ec0f6418c4cbe3d964c2020729c (patch)
tree2172eb81f79a3a93c1b3d1b74f31bfadeeb0a216 /src/test/filestore
parentcrushtool: s/exit(EXIT_FAILURE)/return EXIT_FAILURE/ (diff)
downloadceph-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/filestore')
-rw-r--r--src/test/filestore/TestFileStore.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/filestore/TestFileStore.cc b/src/test/filestore/TestFileStore.cc
index a100a5f3a69..6d857be4116 100644
--- a/src/test/filestore/TestFileStore.cc
+++ b/src/test/filestore/TestFileStore.cc
@@ -68,7 +68,8 @@ int main(int argc, char **argv) {
vector<const char*> args;
argv_to_vec(argc, (const char **)argv, args);
- global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
+ CODE_ENVIRONMENT_UTILITY, 0);
common_init_finish(g_ceph_context);
g_ceph_context->_conf->set_val("osd_journal_size", "100");
g_ceph_context->_conf->apply_changes(NULL);