From 4e4d6466aab259eb0436989401b80b6c3cf87a7c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 17 Jan 2018 10:38:29 -0600 Subject: [PATCH] osd: only exit if *latest* map(s) say we are destroyed It's possible our current map is older, we were destroyed then, but in newer maps our osd was recreated. This happens when the oldest map after a recreated osd happens to land on an epoch where the osd was marked destroyed. Fix by only exiting if one of the newest maps says we are (still) destroyed. Fixes: http://tracker.ceph.com/issues/22673 Signed-off-by: Sage Weil --- src/osd/OSD.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 1bc8822c773..a413204cb2f 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -5402,8 +5402,12 @@ void OSD::_preboot(epoch_t oldest, epoch_t newest) if (osdmap->get_epoch() == 0) { derr << "waiting for initial osdmap" << dendl; } else if (osdmap->is_destroyed(whoami)) { - derr << "osdmap says I am destroyed, exiting" << dendl; - exit(0); + derr << "osdmap says I am destroyed" << dendl; + // provide a small margin so we don't livelock seeing if we + // un-destroyed ourselves. + if (osdmap->get_epoch() > newest - 1) { + exit(0); + } } else if (osdmap->test_flag(CEPH_OSDMAP_NOUP) || osdmap->is_noup(whoami)) { derr << "osdmap NOUP flag is set, waiting for it to clear" << dendl; } else if (!osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)) { -- 2.39.5