From 8a77e1f4dc0668e5ad568bcefc6942d77b8a6eb5 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 30 Jul 2018 08:40:59 +0800 Subject: [PATCH] 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 --- src/crush/CrushWrapper.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 58e44da9183..3853f397552 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 -- 2.39.5