From: xie xingguo Date: Mon, 30 Jul 2018 00:40:59 +0000 (+0800) Subject: crush/CrushWrapper: check against dead crush rule X-Git-Tag: v14.0.1~633^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8a77e1f4dc0668e5ad568bcefc6942d77b8a6eb5;p=ceph.git crush/CrushWrapper: check against dead crush rule 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 --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 58e44da918368..3853f397552d8 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -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