From fa2736927f045fdab681e9fa7cc51246d7ff5108 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sat, 18 Feb 2017 23:02:47 +0100 Subject: [PATCH] crush: get_item_weight must not fail on root Signed-off-by: Loic Dachary --- src/crush/CrushWrapper.cc | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.3