]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMonitor: bug fix pg monitor get crush rule 5377/head
authorXinze Chi <xmdxcxz@gmail.com>
Fri, 3 Jul 2015 10:27:13 +0000 (18:27 +0800)
committerLoic Dachary <ldachary@redhat.com>
Tue, 28 Jul 2015 13:19:44 +0000 (15:19 +0200)
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>
(cherry picked from commit 498793393c81c0a8e37911237969fba495a3a183)

src/mon/PGMonitor.cc

index e699efb652b7bba4ea3d99c1c431d8cd738866e2..60b98d6aff0dafca4fab6930654c6a65489ea47f 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 ||