]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: check against dead crush rule
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 30 Jul 2018 00:40:59 +0000 (08:40 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 9 Aug 2018 00:44:58 +0000 (08:44 +0800)
We currently remove a rule without adjusting the **rules** array
because we don't recycle the rule_no and hence there can be
holes in the "rules" array.

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

index 58e44da918368386bd5e71189e0215f6fbaf3d9c..3853f397552d897633b06c2e9d1f26093888a3b0 100644 (file)
@@ -891,7 +891,7 @@ void CrushWrapper::get_children_of_type(int id,
 int CrushWrapper::get_rule_failure_domain(int rule_id)
 {
   crush_rule *rule = get_rule(rule_id);
-  if (IS_ERR(rule)) {
+  if (IS_ERR(rule) || !rule) {
     return -ENOENT;
   }
   int type = 0; // default to osd-level