Skip to content

Commit

Permalink
mds: use a random nonce in Messenger
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John Spray committed Sep 19, 2016
1 parent 22053d0 commit 5ba6128
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ceph_mds.cc
Expand Up @@ -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(), 0, Messenger::HAS_MANY_CONNECTIONS);
nonce, 0, Messenger::HAS_MANY_CONNECTIONS);
if (!msgr)
exit(1);
msgr->set_cluster_protocol(CEPH_MDS_PROTOCOL);
Expand Down

0 comments on commit 5ba6128

Please sign in to comment.