]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: check against crush-tree changing
authorxiexingguo <xie.xingguo@gmail.com>
Thu, 26 Apr 2018 11:47:35 +0000 (19:47 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 27 Apr 2018 01:16:23 +0000 (09:16 +0800)
pg_upmap/pg_upmap_items should not bring osds which
no longer belong to a specific crush-tree in.

Signed-off-by: xiexingguo <xie.xingguo@gmail.com>
src/osd/OSDMap.cc

index 28bf397f3d7f832d670d1742c6726d44d3f536fd..6ca4236b60358c3aa1a37cb6acb028f3152b0647 100644 (file)
@@ -4195,6 +4195,8 @@ int OSDMap::calc_pg_upmaps(
     for (auto p = deviation_osd.rbegin(); p != deviation_osd.rend(); ++p) {
       int osd = p->second;
       float deviation = p->first;
+      // make sure osd is still there (belongs to this crush-tree)
+      assert(osd_weight.count(osd));
       float target = osd_weight[osd] * pgs_per_weight;
       assert(target > 0);
       if (deviation/target < max_deviation_ratio) {