From a3852769e9a2188ba19c840276a9f831896388ac Mon Sep 17 00:00:00 2001 From: xiexingguo Date: Thu, 26 Apr 2018 19:47:35 +0800 Subject: [PATCH] osd/OSDMap: check against crush-tree changing pg_upmap/pg_upmap_items should not bring osds which no longer belong to a specific crush-tree in. Signed-off-by: xiexingguo --- src/osd/OSDMap.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 28bf397f3d7f8..6ca4236b60358 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -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) { -- 2.39.5