From 5445461ba08fa5b2e12a951a1432916224d3f668 Mon Sep 17 00:00:00 2001 From: Xinze Chi Date: Fri, 3 Jul 2015 18:27:13 +0800 Subject: [PATCH] mon/PGMonitor: bug fix pg monitor get crush rule when some rules have been deleted before, the index in array of crush->rules is not always equals to crush_ruleset of pool. Fixes: #12210 Reported-by: Ning Yao Signed-off-by: Xinze Chi (cherry picked from commit 498793393c81c0a8e37911237969fba495a3a183) --- src/mon/PGMonitor.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 3e0523bba898d..dd65da511e6e5 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1000,8 +1000,8 @@ bool PGMonitor::register_new_pgs() ++p) { int64_t poolid = p->first; pg_pool_t &pool = p->second; - int ruleno = pool.get_crush_ruleset(); - if (!osdmap->crush->rule_exists(ruleno)) + int ruleno = osdmap->crush->find_rule(pool.get_crush_ruleset(), pool.get_type(), pool.get_size()); + if (ruleno < 0 || !osdmap->crush->rule_exists(ruleno)) continue; if (pool.get_last_change() <= pg_map.last_pg_scan ||