From: Samuel Just Date: Thu, 28 Apr 2016 20:47:48 +0000 (-0700) Subject: OSDMonitor: avoid underflow in reweight-by-utilization if max_change=1 X-Git-Tag: v11.0.0~789^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c121bc51a5a877a49094cfbd3bd16af1f3ae5090;p=ceph.git OSDMonitor: avoid underflow in reweight-by-utilization if max_change=1 Fixes: http://tracker.ceph.com/issues/15655 Signed-off-by: Samuel Just --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 7ec912b6d1e7..0e725afe8dc9 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -621,7 +621,8 @@ int OSDMonitor::reweight_by_utilization(int oload, // to represent e.g. differing storage capacities unsigned weight = osdmap.get_weight(p->first); unsigned new_weight = (unsigned)((average_util / util) * (float)weight); - new_weight = MAX(new_weight, weight - max_change); + if (weight > max_change) + new_weight = MAX(new_weight, weight - max_change); newinc.new_weight[p->first] = new_weight; if (!dry_run) { pending_inc.new_weight[p->first] = new_weight;