From: xie xingguo Date: Sat, 22 Jul 2017 06:05:32 +0000 (+0800) Subject: mon/HealthMontior: guard propose_pending() process X-Git-Tag: v12.1.2~86^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=17c4a76f7e3c09ed67eb4bc3c2928d1be2b8781b;p=ceph.git mon/HealthMontior: guard propose_pending() process Which is for leader only. The current code logic has no problem but this is defensive and therefore should be considered as a fine cleanup. Signed-off-by: xie xingguo --- diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index 9775344aa57e..e9e5ad3aa4a2 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -198,10 +198,11 @@ void HealthMonitor::tick() if (check_member_health()) { changed = true; } - if (mon->is_leader()) { - if (check_leader_health()) { - changed = true; - } + if (!mon->is_leader()) { + return; + } + if (check_leader_health()) { + changed = true; } if (changed) { propose_pending();