From 6e58732f546ec6241b198d2473902d66327cdc36 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Mon, 19 Jan 2015 18:49:15 +0000 Subject: [PATCH] mon: PGMonitor: skip zeroed osd stats on get_rule_avail() Fixes: #10257 Signed-off-by: Joao Eduardo Luis (cherry picked from commit b311e7c36273efae39aa2602c1f8bd90d39e5975) Conflicts: src/mon/PGMonitor.cc ceph::unordered_map changed the context, simple resolution --- src/mon/PGMonitor.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 9a4aee36ae20..3e0523bba898 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1258,6 +1258,11 @@ int64_t PGMonitor::get_rule_avail(OSDMap& osdmap, int ruleno) return 0; int64_t min = -1; for (map::iterator p = wm.begin(); p != wm.end(); ++p) { + if (pg_map.osd_stat[p->first].kb == 0) { + // osd must be out, hence its stats have been zeroed + // (unless we somehow managed to have a disk with size 0...) + continue; + } int64_t proj = (float)(pg_map.osd_stat[p->first].kb_avail * 1024ull) / (double)p->second; if (min < 0 || proj < min) -- 2.47.3