]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: use a random nonce in Messenger
authorJohn Spray <john.spray@redhat.com>
Mon, 19 Sep 2016 14:22:01 +0000 (15:22 +0100)
committerLoic Dachary <ldachary@redhat.com>
Wed, 9 Nov 2016 11:14:39 +0000 (12:14 +0100)
The MDS is a client to the OSDs, and responds
to blacklists by respawning itself.  Usually
respawns of a daemonized process result in a PID
change, but it's not guaranteed, and it's definitely
not the case when someone runs in foreground (e.g.
teuthology).

Using a random nonce makes sure we won't match
against an existing blacklist entry from a failed
instance of an MDS daemon with the same name as us.

Related to: http://tracker.ceph.com/issues/17236
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 5ba612882750dae6f0b057c660cd283293a18a3f)

Conflicts:
src/ceph_mds.cc : Messenger::create() prototype is different

src/ceph_mds.cc

index efe22e6b995ffc59fc91cd5877ee6decffd20aff..58bda1b5422acaf85861a394fb86cebe0127599d 100644 (file)
@@ -136,9 +136,12 @@ int main(int argc, const char **argv)
       "MDS names may not start with a numeric digit." << dendl;
   }
 
+  uint64_t nonce = 0;
+  get_random_bytes((char*)&nonce, sizeof(nonce));
+
   Messenger *msgr = Messenger::create(g_ceph_context, g_conf->ms_type,
                                      entity_name_t::MDS(-1), "mds",
-                                     getpid());
+                                     nonce);
   if (!msgr)
     exit(1);
   msgr->set_cluster_protocol(CEPH_MDS_PROTOCOL);