]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: fix MgrStandby eating messages 15716/head
authorJohn Spray <john.spray@redhat.com>
Thu, 15 Jun 2017 19:57:36 +0000 (15:57 -0400)
committerJohn Spray <john.spray@redhat.com>
Thu, 15 Jun 2017 22:38:27 +0000 (18:38 -0400)
It was failing to pass up the Mgr::ms_dispatch
return value, so messages were being consumed
even if Mgr was returning false.  Mgr returns
false to enable Client to see FSMap, so the
symptom was the Client not working.

While we're here, refactor switch into if, because
there were only two paths in the switch and we
don't expect to be adding more.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/MgrStandby.cc

index 12a211b120b1588bfb5662c1ce47210150e1d6c0..d46dc194aa7f8450db01b1246b2e8380aa7edbdc 100644 (file)
@@ -304,23 +304,18 @@ bool MgrStandby::ms_dispatch(Message *m)
   Mutex::Locker l(lock);
   dout(4) << state_str() << " " << *m << dendl;
 
-  switch (m->get_type()) {
-    case MSG_MGR_MAP:
-      handle_mgr_map(static_cast<MMgrMap*>(m));
-      break;
-
-    default:
-      if (active_mgr) {
-       auto am = active_mgr;
-        lock.Unlock();
-        am->ms_dispatch(m);
-        lock.Lock();
-      } else {
-        return false;
-      }
+  if (m->get_type() == MSG_MGR_MAP) {
+    handle_mgr_map(static_cast<MMgrMap*>(m));
+    return true;
+  } else if (active_mgr) {
+    auto am = active_mgr;
+    lock.Unlock();
+    bool handled = am->ms_dispatch(m);
+    lock.Lock();
+    return handled;
+  } else {
+    return false;
   }
-
-  return true;
 }