From: Loic Dachary Date: Sat, 18 Feb 2017 22:02:47 +0000 (+0100) Subject: crush: get_item_weight must not fail on root X-Git-Tag: v12.0.1~135^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fa2736927f045fdab681e9fa7cc51246d7ff5108;p=ceph.git crush: get_item_weight must not fail on root Signed-off-by: Loic Dachary --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 3be8a11c237..a5c744847ee 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -818,6 +818,8 @@ int CrushWrapper::get_item_weight(int id) const crush_bucket *b = crush->buckets[bidx]; if (b == NULL) continue; + if (b->id == id) + return b->weight; for (unsigned i = 0; i < b->size; i++) if (b->items[i] == id) return crush_get_bucket_item_weight(b, i);