]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: fix erasure-code premature deallocation of cct
authorLoic Dachary <ldachary@redhat.com>
Thu, 8 Dec 2016 11:40:42 +0000 (12:40 +0100)
committerNathan Cutler <ncutler@suse.com>
Tue, 25 Apr 2017 13:48:00 +0000 (15:48 +0200)
The setup function returns before the run function, the cct variable
must be a data member, not a local variable that gets de-allocated
before run() starts.

Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit efa1e54362423d4cfd1541fb8c68237b7b9ebbe3)

src/test/erasure-code/ceph_erasure_code.cc
src/test/erasure-code/ceph_erasure_code_benchmark.cc
src/test/erasure-code/ceph_erasure_code_benchmark.h

index 8ed2b0ce49e73feb53cd2c2d3ebc4c1432fe1e82..5d7f25f5b3872c87552624cc8b1a4a51d8565080 100644 (file)
@@ -37,6 +37,7 @@ namespace po = boost::program_options;
 class ErasureCodeCommand {
   po::variables_map vm;
   ErasureCodeProfile profile;
+  boost::intrusive_ptr<CephContext> cct;
 public:
   int setup(int argc, char** argv);
   int run();
@@ -82,7 +83,7 @@ int ErasureCodeCommand::setup(int argc, char** argv) {
     ceph_options.push_back(i->c_str());
   }
 
-  auto cct = global_init(
+  cct = global_init(
     &def_args, ceph_options, CEPH_ENTITY_TYPE_CLIENT,
     CODE_ENVIRONMENT_UTILITY,
     CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
index 01250cc774bdaca05c8d8d3693c73f2731681ff9..238d8e6af8266e9d0f33b2b28b2a2608b51f10b0 100644 (file)
@@ -81,7 +81,7 @@ int ErasureCodeBench::setup(int argc, char** argv) {
     ceph_options.push_back(i->c_str());
   }
 
-  auto cct = global_init(
+  cct = global_init(
     &def_args, ceph_options, CEPH_ENTITY_TYPE_CLIENT,
     CODE_ENVIRONMENT_UTILITY,
     CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
index c9375916473abe51bccd9e0fdc5ae04ae35237f1..c65f716b1e17826aa7036a7c3d6aa1506cd1b1d2 100644 (file)
@@ -38,6 +38,7 @@ class ErasureCodeBench {
   ErasureCodeProfile profile;
 
   bool verbose;
+  boost::intrusive_ptr<CephContext> cct;
 public:
   int setup(int argc, char** argv);
   int run();