From f3760da4feb02a5b25794615ad67f07b3e1370b9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 4 May 2012 12:09:28 -0700 Subject: [PATCH] crush: update_item() should pass an error back to the caller 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 Signed-off-by: Sage Weil --- src/crush/CrushWrapper.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 74cd752a718e9..85e072615c4d7 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -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; } -- 2.39.5