]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: fix create_or_move_item when name exists but item does not 3178/head
authorSage Weil <sage@redhat.com>
Mon, 24 Nov 2014 02:50:51 +0000 (18:50 -0800)
committerLoic Dachary <ldachary@redhat.com>
Fri, 9 Jan 2015 12:11:47 +0000 (13:11 +0100)
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>
(cherry picked from commit 9902383c690dca9ed5ba667800413daa8332157e)

src/crush/CrushWrapper.cc

index 1640550394567563b030169360d33625ec9cb1be..34d430da4b0a12a798c5ac71a9530729be0ae4fc 100644 (file)
@@ -585,7 +585,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);