ceph/src/crush
Joao Eduardo Luis d6cf77dcbb crush: CrushWrapper: don't add item to a bucket with != type than wanted
We take little consideration about the type of the bucket we are adding
an item to. Although this works for the vast majority of cases, it was
also leaving room for silly little mistakes to become problematic and
leading a monitor to crash.

For instance, say that we ran:
  'ceph osd crush set 0 osd.0 1 root=foo row=foo'

If root 'foo' exists, then this will work and 'row=foo' will be ignored.
However, if there is no bucket named 'foo', then we would (in order)
create a bucket for row 'foo', adding osd.0 to it, and would then add
osd.0 to bucket 'foo' again -- remember, little consideration regarding
the bucket type was given.

This would trigger a monitor crash due to the recursion done in
'adjust_item_weight'. A solution to this problem is to make sure that we
do not allow specifying multiple buckets with the same name when adding
an item to crush. Not only solves our crash problem, but will also render
invalid any mistake when specifying the wrong bucket type (say, using
'row=bar' when in fact 'bar' is a rack).

Fixes: #3515

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2012-11-23 19:12:57 +00:00
..
builder.c
builder.h
crush.c
crush.h
CrushCompiler.cc
CrushCompiler.h
CrushTester.cc crushtester: fix uninit var 2012-09-28 13:18:05 -07:00
CrushTester.h crushtool: Miscellaneous cleanup. 2012-08-31 13:20:30 -07:00
CrushWrapper.cc crush: CrushWrapper: don't add item to a bucket with != type than wanted 2012-11-23 19:12:57 +00:00
CrushWrapper.h crush: prevent loops from insert_item 2012-11-22 09:17:34 -08:00
CrushWrapper.i
grammar.h
hash.c
hash.h
mapper.c
mapper.h
old_sample.txt
sample.txt
types.h