]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mon: get own entity_inst_t via messenger, not monmap
authorSage Weil <sage@inktank.com>
Thu, 25 Apr 2013 22:18:42 +0000 (15:18 -0700)
committerSage Weil <sage@inktank.com>
Thu, 25 Apr 2013 22:18:55 +0000 (15:18 -0700)
commit3ce35a6743e050bf0de5abd5ad32f522c5664f3d
treeccd38b2073be361522aba4fa07d18dd4ffe26e38
parentb0ba41235af901bd7e64588e2a247c6a56ec5cfa
mon: get own entity_inst_t via messenger, not monmap

There are intervals during bootstrap(*) during which we are part of the
monmap, but our name (mon->name) does not match the monmap's.  This means
that calling monmap->get_inst(mon->name) is not a safe way to get our own
entity_inst_t.

Instead, use messenger->get_myinst().  This includes our addr (obviously)
and an up-to-date entity_name_t, too: in bootstrap we adjust the messenger
name at the same time as mon->rank, based on the contents of the monmap.

monmap->get_inst(mon->rank) would work too.

* During mkfs, the monmap may have noname-foo instead of the name if it was
  generated from the mon_host lines or dns or whatever by
  MonMap::build_initial().  This was the case for #4811.

Fixes: #4811
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/mon/DataHealthService.cc
src/mon/Monitor.cc