]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: CrushWrapper::add_bucket - do not allow caller pass in null 'idout'
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 14 Aug 2017 06:23:24 +0000 (14:23 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 22 Aug 2017 14:45:48 +0000 (22:45 +0800)
*** Caught signal (Segmentation fault) **
 in thread 7f495c0f6300 thread_name:crushtool
 ceph version 12.1.2-768-gab69125 (ab6912523e779174f92f0b0fc10372bd0b645415) mimic (dev)
 1: (()+0x1a3d1) [0x7f495c1343d1]
 2: (()+0xf370) [0x7f4951deb370]
 3: (CrushWrapper::add_bucket(int, int, int, int, int, int*, int*, int*)+0x84) [0x7f49538ba084]
 4: (CrushCompiler::parse_bucket(__gnu_cxx::__normal_iterator<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> >*, std::vector<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> >, std::allocator<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> > > > > const&)+0xef0) [0x7f49538dc170]
 5: (CrushCompiler::parse_crush(__gnu_cxx::__normal_iterator<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> >*, std::vector<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> >, std::allocator<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> > > > > const&)+0x130) [0x7f49538dcba0]
 6: (CrushCompiler::compile(std::istream&, char const*)+0xb93) [0x7f49538deaa3]
 7: (main()+0x2615) [0x7f495c126015]
 8: (__libc_start_main()+0xf5) [0x7f49507ccb35]
 9: (()+0xf4b0) [0x7f495c1294b0]
2017-08-14 13:31:25.498050 7f495c0f6300 -1 *** Caught signal (Segmentation fault) **
 in thread 7f495c0f6300 thread_name:crushtool

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/crush/CrushCompiler.cc
src/crush/CrushWrapper.cc

index eb4f7b7cf4a6e70144da8341918ac18abcc7a309..02ed45935799fcba990f65ef3edfb5f5216f9a94 100644 (file)
@@ -741,7 +741,9 @@ int CrushCompiler::parse_bucket(iter_t const& i)
   item_weight[id] = bucketweight;
   
   assert(id != 0);
-  int r = crush.add_bucket(id, alg, hash, type, size, &items[0], &weights[0], NULL);
+  int idout;
+  int r = crush.add_bucket(id, alg, hash, type, size,
+                           &items[0], &weights[0], &idout);
   if (r < 0) {
     if (r == -EEXIST)
       err << "Duplicate bucket id " << id << std::endl;
index d95e8b8d6d049e13dc22c8df6bf03a3dbfab523a..006c20f2e1e24f877eed91bf315d46939d34ec77 100644 (file)
@@ -1702,6 +1702,7 @@ int CrushWrapper::add_bucket(
   crush_bucket *b = crush_make_bucket(crush, alg, hash, type, size, items,
                                      weights);
   assert(b);
+  assert(idout);
   int r = crush_add_bucket(crush, bucketno, b, idout);
   int pos = -1 - *idout;
   for (auto& p : choose_args) {