diff mbox series

[Xenial,SRU,6/6] Revert "crush: ensure bucket id is valid before indexing buckets array"

Message ID 20171208184313.32316-7-cascardo@canonical.com
State New
Headers show
Series LP #1737033 | expand

Commit Message

Thadeu Lima de Souza Cascardo Dec. 8, 2017, 6:43 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1737033

This reverts commit 75ee940e71ed7841958cace371a5c79076a0378c.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 net/ceph/crush/mapper.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
index 97ecf6f262aa..393bfb22d5bb 100644
--- a/net/ceph/crush/mapper.c
+++ b/net/ceph/crush/mapper.c
@@ -888,7 +888,6 @@  int crush_do_rule(const struct crush_map *map,
 			osize = 0;
 
 			for (i = 0; i < wsize; i++) {
-				int bno;
 				/*
 				 * see CRUSH_N, CRUSH_N_MINUS macros.
 				 * basically, numrep <= 0 means relative to
@@ -901,13 +900,6 @@  int crush_do_rule(const struct crush_map *map,
 						continue;
 				}
 				j = 0;
-				/* make sure bucket id is valid */
-				bno = -1 - w[i];
-				if (bno < 0 || bno >= map->max_buckets) {
-					/* w[i] is probably CRUSH_ITEM_NONE */
-					dprintk("  bad w[i] %d\n", w[i]);
-					continue;
-				}
 				if (firstn) {
 					int recurse_tries;
 					if (choose_leaf_tries)
@@ -919,7 +911,7 @@  int crush_do_rule(const struct crush_map *map,
 						recurse_tries = choose_tries;
 					osize += crush_choose_firstn(
 						map,
-						map->buckets[bno],
+						map->buckets[-1-w[i]],
 						weight, weight_max,
 						x, numrep,
 						curstep->arg2,
@@ -938,7 +930,7 @@  int crush_do_rule(const struct crush_map *map,
 						    numrep : (result_max-osize));
 					crush_choose_indep(
 						map,
-						map->buckets[bno],
+						map->buckets[-1-w[i]],
 						weight, weight_max,
 						x, out_size, numrep,
 						curstep->arg2,