]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: make get_immediate_parent[_id] ignore per-class shadow hierarchy
authorSage Weil <sage@redhat.com>
Tue, 11 Jul 2017 15:45:03 +0000 (11:45 -0400)
committerSage Weil <sage@redhat.com>
Thu, 13 Jul 2017 16:14:26 +0000 (12:14 -0400)
Fixes: http://tracker.ceph.com/issues/20546
Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc

index 3bdc7d73c31e2461cfc6657c2d40422f3c82eeed..9530b3d932680c816a09826a85fc81ff9f363909 100644 (file)
@@ -1211,6 +1211,9 @@ pair<string,string> 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;