Skip to content

Commit

Permalink
OSDMonitor: avoid underflow in reweight-by-utilization if max_change=1
Browse files Browse the repository at this point in the history
Fixes: http://tracker.ceph.com/issues/15655
Signed-off-by: Samuel Just <sjust@redhat.com>
  • Loading branch information
athanatos committed Apr 28, 2016
1 parent b3d766b commit c121bc5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mon/OSDMonitor.cc
Expand Up @@ -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;
Expand Down

0 comments on commit c121bc5

Please sign in to comment.