From 0a691b2b1c19fbc30af5c4046736dacb2fb8bfa4 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 --- 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 b53ff581773e2..928287bf89e72 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -7936,6 +7936,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; @@ -8017,11 +8026,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 c84d035cebfe7..11203480c56fd 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5318,8 +5318,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