]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor: avoid underflow in reweight-by-utilization if max_change=1 8836/head
authorSamuel Just <sjust@redhat.com>
Thu, 28 Apr 2016 20:47:48 +0000 (13:47 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 28 Apr 2016 21:04:19 +0000 (14:04 -0700)
Fixes: http://tracker.ceph.com/issues/15655
Signed-off-by: Samuel Just <sjust@redhat.com>
src/mon/OSDMonitor.cc

index 7ec912b6d1e782b949fb680a73117ecb2de4730a..0e725afe8dc927f76ae50117a8bd37523bb83b3a 100644 (file)
@@ -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;