From: Xiaoxi Chen Date: Fri, 25 Dec 2015 03:07:45 +0000 (+0800) Subject: osd/OSD.cc Check health state before pre_booting X-Git-Tag: v10.0.3~81^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dd8221dd9dad0a99e0d0785e69c647c8386ebbb3;p=ceph.git osd/OSD.cc Check health state before pre_booting In previous code we forgot to check the health state before going to STATE_PREBOOT, which will result OSD flapping when public/cluster network failure. Fixes: #14181 Signed-off-by: Xiaoxi Chen --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 4a212d470ac8..06a91e17af38 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3979,10 +3979,7 @@ void OSD::tick() } if (is_waiting_for_healthy()) { - if (_is_healthy()) { - dout(1) << "healthy again, booting" << dendl; - start_boot(); - } + start_boot(); } if (is_active()) { @@ -4467,6 +4464,16 @@ struct C_OSD_GetVersion : public Context { void OSD::start_boot() { + if (!_is_healthy()) { + // if we are not healthy, do not mark ourselves up (yet) + dout(1) << "not healthy; waiting to boot" << dendl; + if (!is_waiting_for_healthy()) + start_waiting_for_healthy(); + // send pings sooner rather than later + heartbeat_kick(); + return; + } + dout(1) << "We are healthy, booting" << dendl; set_state(STATE_PREBOOT); dout(10) << "start_boot - have maps " << superblock.oldest_map << ".." << superblock.newest_map << dendl; @@ -4498,13 +4505,6 @@ void OSD::_preboot(epoch_t oldest, epoch_t newest) (osdmap->get_up_osd_features() & CEPH_FEATURE_HAMMER_0_94_4) == 0) { dout(1) << "osdmap indicates one or more pre-v0.94.4 hammer OSDs is running" << dendl; - } else if (is_waiting_for_healthy() || !_is_healthy()) { - // if we are not healthy, do not mark ourselves up (yet) - dout(1) << "not healthy; waiting to boot" << dendl; - if (!is_waiting_for_healthy()) - start_waiting_for_healthy(); - // send pings sooner rather than later - heartbeat_kick(); } else if (osdmap->get_epoch() >= oldest - 1 && osdmap->get_epoch() + cct->_conf->osd_map_message_max > newest) { _send_boot();