mirror of
https://github.com/ceph/ceph
synced 2024-12-28 06:23:08 +00:00
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>
This commit is contained in:
parent
8c87e95021
commit
9902383c69
@ -651,7 +651,7 @@ int CrushWrapper::create_or_move_item(CephContext *cct, int item, float weight,
|
||||
if (check_item_loc(cct, item, loc, &old_iweight)) {
|
||||
ldout(cct, 5) << "create_or_move_item " << item << " already at " << loc << dendl;
|
||||
} else {
|
||||
if (item_exists(item)) {
|
||||
if (_search_item_exists(item)) {
|
||||
weight = get_item_weightf(item);
|
||||
ldout(cct, 10) << "create_or_move_item " << item << " exists with weight " << weight << dendl;
|
||||
remove_item(cct, item, true);
|
||||
|
Loading…
Reference in New Issue
Block a user