]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: update_item() should pass an error back to the caller
authorSage Weil <sage@newdream.net>
Fri, 4 May 2012 19:09:28 +0000 (12:09 -0700)
committerSage Weil <sage@newdream.net>
Fri, 4 May 2012 19:09:28 +0000 (12:09 -0700)
If you give it a nonsensical loc, it will fail check_item_loc() (false) and
then error out on insert_item().

Reported-by: Sam Just <sam.just@inktank.com>
Signed-off-by: Sage Weil <sage@newdream.net>
src/crush/CrushWrapper.cc

index 74cd752a718e9c19b30116aa68d69acaf4d3b017..85e072615c4d7d52a26d401d4e6c3b89ca4d549c 100644 (file)
@@ -208,9 +208,9 @@ int CrushWrapper::update_item(CephContext *cct, int item, float weight, string n
     }
     ldout(cct, 5) << "update_item adding " << item << " weight " << weight
                  << " at " << loc << dendl;
-    int r = insert_item(cct, item, weight, name.c_str(), loc);
-    if (r == 0)
-      ret = 1;
+    ret = insert_item(cct, item, weight, name.c_str(), loc);
+    if (ret == 0)
+      ret = 1;  // changed
   }
   return ret;
 }