From: Sage Weil Date: Tue, 11 Jul 2017 15:45:03 +0000 (-0400) Subject: crush/CrushWrapper: make get_immediate_parent[_id] ignore per-class shadow hierarchy X-Git-Tag: v12.1.1~19^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0f2e985e3c7d3ba3a3ae17ee0c1cf282e7d69ee0;p=ceph.git crush/CrushWrapper: make get_immediate_parent[_id] ignore per-class shadow hierarchy Fixes: http://tracker.ceph.com/issues/20546 Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 3bdc7d73c31e..9530b3d93268 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1211,6 +1211,9 @@ pair CrushWrapper::get_immediate_parent(int id, int *_ret) crush_bucket *b = crush->buckets[bidx]; if (b == 0) continue; + const char *n = get_item_name(b->id); + if (n && !is_valid_crush_name(n)) + continue; for (unsigned i = 0; i < b->size; i++) if (b->items[i] == id) { string parent_id = name_map[b->id]; @@ -1233,6 +1236,9 @@ int CrushWrapper::get_immediate_parent_id(int id, int *parent) const crush_bucket *b = crush->buckets[bidx]; if (b == 0) continue; + const char *n = get_item_name(b->id); + if (n && !is_valid_crush_name(n)) + continue; for (unsigned i = 0; i < b->size; i++) { if (b->items[i] == id) { *parent = b->id;