]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/MgrClient: fix open condition
authorSage Weil <sage@redhat.com>
Wed, 30 Oct 2019 14:39:47 +0000 (09:39 -0500)
committerSage Weil <sage@redhat.com>
Wed, 22 Jan 2020 00:13:22 +0000 (18:13 -0600)
Do not open a mgr daemon session if we are a client using a non-client
key to authenticate.  This is a bit of a corner case, but it can
happen when using the mon. key do bootstrap functions.

This aligns the MgrClient condition with the mgr/DaemonServer.cc
handle_report condition, which rejects non-daemon client connections
based on the connection entity type, not the auth identity.

Fixes: https://tracker.ceph.com/issues/42566
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit fc60989bf7a72c35b8f6b8fec2407b3080ad9bbd)

src/mgr/MgrClient.cc

index 6a61317aa06d8c8400d49a012f798b31f1ae123a..f4f42c353376791cc43a2a880cf178561ee38f0f 100644 (file)
@@ -163,7 +163,7 @@ void MgrClient::reconnect()
 
   // Don't send an open if we're just a client (i.e. doing
   // command-sending, not stats etc)
-  if (!cct->_conf->name.is_client() || service_daemon) {
+  if (msgr->get_mytype() != CEPH_ENTITY_TYPE_CLIENT || service_daemon) {
     _send_open();
   }
 
@@ -499,7 +499,7 @@ int MgrClient::service_daemon_register(
   daemon_dirty_status = true;
 
   // late register?
-  if (cct->_conf->name.is_client() && session && session->con) {
+  if (msgr->get_mytype() != CEPH_ENTITY_TYPE_CLIENT && session && session->con) {
     _send_open();
   }