]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: return error instead of BUGing on bad forcefed mapping
authorSage Weil <sage@newdream.net>
Fri, 20 Aug 2010 16:26:34 +0000 (09:26 -0700)
committerSage Weil <sage@newdream.net>
Fri, 20 Aug 2010 16:26:34 +0000 (09:26 -0700)
The forcefed mapping relies on a parent map.  However, the current
implementation assumes that the parent mapping is unique for all rules. If
that is not the case (i.e., some osd exists in multiple hierarchies) then
we cannot assert that the TAKE matches the calculated force_context.

For now, we can just fail the mapping in that case (we don't use forcefed
mappings yet).  The real solution is probably to define parent maps for
all possible hierarchies (i.e., starting at each unique TAKE starting
point).

Signed-off-by: Sage Weil <sage@newdream.net>
src/crush/mapper.c

index a4eec133258e80a880a8cecca0282c54e11982ac..d903426a1f2f69ad5d4d4c6f7ed77cd01b7577b5 100644 (file)
@@ -517,7 +517,10 @@ int crush_do_rule(struct crush_map *map,
                case CRUSH_RULE_TAKE:
                        w[0] = rule->steps[step].arg1;
                        if (force_pos >= 0) {
-                               BUG_ON(force_context[force_pos] != w[0]);
+                               if (force_context[force_pos] != w[0]) {
+                                       rc = -1;  /* forced mapping dne */
+                                       goto out;
+                               }
                                force_pos--;
                        }
                        wsize = 1;