From: Sage Weil Date: Fri, 12 Jan 2018 23:37:00 +0000 (-0600) Subject: crush/CrushWrapper: fix finalize clobbering of max_devices X-Git-Tag: v13.0.2~286^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1e48ee9c592891fcaa5ae82fc53d45231156a62c;p=ceph.git crush/CrushWrapper: fix finalize clobbering of max_devices This hides device names when they don't appear in the hierarchy, e.g. after setting a name and class for a new device that hasn't yet been put in the tree. Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index ed13ff26d67c5..5bd5c47a57668 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -1251,6 +1251,10 @@ public: void finalize() { assert(crush); crush_finalize(crush); + if (!name_map.empty() && + name_map.rbegin()->first >= crush->max_devices) { + crush->max_devices = name_map.rbegin()->first + 1; + } have_uniform_rules = !has_legacy_rule_ids(); } int bucket_set_alg(int id, int alg);