From 9ae29004e1fb72dd8b5c37720579004047da68a5 Mon Sep 17 00:00:00 2001 From: sageweil Date: Tue, 23 Oct 2007 21:27:22 +0000 Subject: [PATCH] better error checking git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1987 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/crush/crush/mapper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/branches/sage/crush/crush/mapper.c b/branches/sage/crush/crush/mapper.c index 465f343233a63..fe0af8c9c8ed0 100644 --- a/branches/sage/crush/crush/mapper.c +++ b/branches/sage/crush/crush/mapper.c @@ -200,7 +200,7 @@ static int crush_choose(struct crush_map *map, /* keep going? */ if (itemtype != type) { - BUG_ON((-1-item) >= map->max_buckets); + BUG_ON(item >= 0 || (-1-item) >= map->max_buckets); in = map->buckets[-1-item]; continue; } @@ -274,8 +274,13 @@ int crush_do_rule(struct crush_map *map, /* determine hierarchical context of forcefeed, if any */ if (forcefeed >= 0) { + if (map->device_parents[forcefeed] == 0) { + printf("CRUSH: forcefed device dne\n"); + return -1; /* force fed device dne */ + } while (1) { force_stack[++force_pos] = forcefeed; + /*printf("force_stack[%d] = %d\n", force_pos, forcefeed);*/ if (forcefeed >= 0) forcefeed = map->device_parents[forcefeed]; else -- 2.39.5