]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: MMonGetMap doesn't require caps 2777/head
authorJoao Eduardo Luis <joao@redhat.com>
Wed, 22 Oct 2014 18:30:08 +0000 (19:30 +0100)
committerJoao Eduardo Luis <joao@redhat.com>
Wed, 22 Oct 2014 18:33:55 +0000 (19:33 +0100)
We are dropping the requirement for MON_CAP_R for MMonGetMap.

Reason is simple enough: clients may need to contact the monitors and
obtain the latest monmap before authenticating.  This happens, for
instance, when a client calls MonClient::get_monmap_privately().  The
osd uses this function during mkfs, prior to initializing a keyring or
even so much as existing.

Fixes: #9859
Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
src/mon/Monitor.cc

index a9f10bd7fd34263dd03b6121fa90cf36e1cc8417..52df6f012d34e268215ff2d45f3d464822087933 100644 (file)
@@ -3179,6 +3179,17 @@ void Monitor::dispatch(MonSession *s, Message *m, const bool src_is_mon)
       handle_ping(static_cast<MPing*>(m));
       break;
 
+    /* MMonGetMap may be used by clients to obtain a monmap *before*
+     * authenticating with the monitor.  We need to handle these without
+     * checking caps because, even on a cluster without cephx, we only set
+     * session caps *after* the auth handshake.  A good example of this
+     * is when a client calls MonClient::get_monmap_privately(), which does
+     * not authenticate when obtaining a monmap.
+     */
+    case CEPH_MSG_MON_GET_MAP:
+      handle_mon_get_map(static_cast<MMonGetMap*>(m));
+      break;
+
     default:
       dealt_with = false;
       break;
@@ -3249,10 +3260,6 @@ void Monitor::dispatch(MonSession *s, Message *m, const bool src_is_mon)
   switch (m->get_type()) {
 
     // misc
-    case CEPH_MSG_MON_GET_MAP:
-      handle_mon_get_map(static_cast<MMonGetMap*>(m));
-      break;
-
     case CEPH_MSG_MON_GET_VERSION:
       handle_get_version(static_cast<MMonGetVersion*>(m));
       break;