]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMonitor: bug fix pg monitor get crush rule 5141/head
authorXinze Chi <xmdxcxz@gmail.com>
Fri, 3 Jul 2015 10:27:13 +0000 (18:27 +0800)
committerXinze Chi <xmdxcxz@gmail.com>
Fri, 3 Jul 2015 11:31:36 +0000 (19:31 +0800)
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 <zay11022@gmail.com>
Signed-off-by: Xinze Chi <xmdxcxz@gmail.com>
src/mon/PGMonitor.cc

index 3568d578c3f8d052b400906dc5435d6d07eca86e..4ae4a038f1b09944d774c4cc077169a2f9c67d27 100644 (file)
@@ -1023,8 +1023,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 ||