From 7ec43396a28167255488867cafc2d43270dcaad1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 14 Jul 2017 10:53:14 -0400 Subject: [PATCH] osd: restart boot process if waiting for luminous mons If we start_boot and see that we don't have luminous mons, we will stop. But we don't currently reliably notice when the luminous upgrade completes. If we happen to be connected to the last mon we will start_boot() because of the trigger in ms_handle_connect(), but if we are not connected to the last mon we'll eventually get a monmap update but not restart booting. Fix by setting a flag if we are waiting, and restart boot if the flag is set, we are in preboot, and we see we now have luminous mons. Fixes: http://tracker.ceph.com/issues/20631 Signed-off-by: Sage Weil --- src/osd/OSD.cc | 8 ++++++++ src/osd/OSD.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 0e0b6ba25ec..2600f52dfea 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4987,6 +4987,12 @@ void OSD::tick() if (is_waiting_for_healthy()) { start_boot(); + } else if (is_preboot() && + waiting_for_luminous_mons && + monc->monmap.get_required_features().contains_all( + ceph::features::mon::FEATURE_LUMINOUS)) { + // mon upgrade finished! + start_boot(); } do_waiters(); @@ -5599,6 +5605,7 @@ void OSD::start_boot() } dout(1) << __func__ << dendl; set_state(STATE_PREBOOT); + waiting_for_luminous_mons = false; dout(10) << "start_boot - have maps " << superblock.oldest_map << ".." << superblock.newest_map << dendl; C_OSD_GetVersion *c = new C_OSD_GetVersion(this); @@ -5637,6 +5644,7 @@ void OSD::_preboot(epoch_t oldest, epoch_t newest) ceph::features::mon::FEATURE_LUMINOUS)) { derr << "monmap REQUIRE_LUMINOUS is NOT set; must upgrade all monitors to " << "Luminous or later before Luminous OSDs will boot" << dendl; + waiting_for_luminous_mons = true; } else if (service.need_fullness_update()) { derr << "osdmap fullness state needs update" << dendl; send_full_update(); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index c34e247e444..bfa511e8b07 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1342,6 +1342,7 @@ public: private: std::atomic_int state{STATE_INITIALIZING}; + bool waiting_for_luminous_mons = false; public: int get_state() const { -- 2.47.3