]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: OSDMonitor: only thrash and propose if we are the leader
authorJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 16 Jul 2013 22:02:55 +0000 (23:02 +0100)
committerSage Weil <sage@inktank.com>
Tue, 16 Jul 2013 22:08:10 +0000 (15:08 -0700)
'thrash_map' is only set if we are the leader, so we would thrash and
propose the pending value if we are the leader.  However, we should keep
the 'is_leader()' check not only for clarity's sake (an unfamiliar reader
may cry OMGBUG, prompting to a patch much like this), but also because
we may lose a subsequent election and become a peon instead, while still
holding a 'thrash_map' value > 0 -- and we really don't want to propose
while being a peon.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/mon/OSDMonitor.cc

index 2b4de6d426d068438f0c428a8f5617bfccbc2820..eb674b7bc4c524df177d46cbf133d7cda7684e40 100644 (file)
@@ -297,8 +297,14 @@ void OSDMonitor::on_active()
   send_to_waiting();
   check_subs();
 
-  if (thrash_map && thrash())
-    propose_pending();
+  if (thrash_map) {
+    if (is_leader()) {
+      if (thrash())
+       propose_pending();
+    } else {
+      thrash_map = 0;
+    }
+  }
 
   if (mon->is_leader())
     mon->clog.info() << "osdmap " << osdmap << "\n";