From f0a6f616c6c0358c2a7b9eb24fd6ca9c4290be0a Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 29 Sep 2017 15:18:26 -0700 Subject: [PATCH] osd: make the PG's SORTBITWISE assert a more generous shutdown We want to stop working if we get activated while sortbitwise is not set on the cluster, but we might have old maps where it wasn't if the flag was changed recently. And doing it in the PG code was a bit silly anyway. Instead check SORTBITWISE in the main OSDMap handling code prior to prepublishing it. Let it go through if we aren't active at the time. Fixes: http://tracker.ceph.com/issues/20416 Signed-off-by: Greg Farnum (cherry picked from commit 0a691b2b1c19fbc30af5c4046736dacb2fb8bfa4) --- src/osd/OSD.cc | 14 +++++++++----- src/osd/PG.cc | 2 -- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 426da24400891..0eae4cc37f05a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -8171,6 +8171,15 @@ void OSD::consume_map() assert(osd_lock.is_locked()); dout(7) << "consume_map version " << osdmap->get_epoch() << dendl; + /** make sure the cluster is speaking in SORTBITWISE, because we don't + * speak the older sorting version any more. Be careful not to force + * a shutdown if we are merely processing old maps, though. + */ + if (!osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE) && is_active()) { + derr << __func__ << " SORTBITWISE flag is not set" << dendl; + ceph_abort(); + } + int num_pg_primary = 0, num_pg_replica = 0, num_pg_stray = 0; list to_remove; @@ -8252,11 +8261,6 @@ void OSD::activate_map() dout(7) << "activate_map version " << osdmap->get_epoch() << dendl; - if (!osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)) { - derr << __func__ << " SORTBITWISE flag is not set" << dendl; - ceph_abort(); - } - if (osdmap->test_flag(CEPH_OSDMAP_FULL)) { dout(10) << " osdmap flagged full, doing onetime osdmap subscribe" << dendl; osdmap_subscribe(osdmap->get_epoch() + 1, false); diff --git a/src/osd/PG.cc b/src/osd/PG.cc index da4da001e0404..2b1b577e27d1b 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5530,8 +5530,6 @@ void PG::on_new_interval() upacting_features &= osdmap->get_xinfo(*p).features; } - assert(osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)); - _on_new_interval(); } -- 2.39.5