crush/CrushWrapper: fix _search_item_exists

Reported-by: Pawel Sadowski <ceph@sadziu.pl>
Signed-off-by: Sage Weil <sage@redhat.com>
crush/builder: prevent bucket weight underflow on item removal

It is possible to set a bucket weight that is not the sum of the item
weights if you manually modify/build the CRUSH map.  Protect against any
underflow on the bucket weight when removing items.

Signed-off-by: Sage Weil <sage@redhat.com>
crush/CrushWrapper: fix create_or_move_item when name exists but item does not

We were using item_exists(), which simply checks if we have a name defined
for the item.  Instead, use _search_item_exists(), which looks for an
instance of the item somewhere in the hierarchy.  This matches what
get_item_weightf() is doing, which ensures we get a non-negative weight
that converts properly to floating point.

Backport: giant, firefly
Fixes: #9998
Reported-by: Pawel Sadowski <ceph@sadziu.pl>
Signed-off-by: Sage Weil <sage@redhat.com>
Merge pull request #2986 from ceph/wip-9998

crush: fix weight underfloat issue

Reviewed-by: Loic Dachary <ldachary@redhat.com>