]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make the PG's SORTBITWISE assert a more generous shutdown 18047/head
authorGreg Farnum <gfarnum@redhat.com>
Fri, 29 Sep 2017 22:18:26 +0000 (15:18 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Thu, 5 Oct 2017 17:48:58 +0000 (10:48 -0700)
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 <gfarnum@redhat.com>
src/osd/OSD.cc
src/osd/PG.cc

index b53ff581773e2d694bc430ce97431bfdc69e69e5..928287bf89e729efaeae6973a90b9438df103458 100644 (file)
@@ -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<PGRef> 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);
index c84d035cebfe7d21335eb5618d1748c7ad538e4f..11203480c56fdcdd45652acc6f0433e1cf29e901 100644 (file)
@@ -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();
 }