From f16187f68d7f494fd5ed243e163a8ae3cb111cd3 Mon Sep 17 00:00:00 2001 From: Sage Weil <sage@redhat.com> Date: Wed, 30 Mar 2016 11:55:55 -0400 Subject: [PATCH] osdc/Objecter: use full hash value for pg[n]ls ops Normal ops do this so they can behave when racing with split; pgnls ops are no different. In particular, this fixes a bug where we have an old OSDMap that doesn't reflect a split, and the OSD replies with a 'next' value of the PG's new max. If we resend the same value to that PG, it'll be out of bounds, and BlueStore will notice. Signed-off-by: Sage Weil <sage@redhat.com> --- src/osdc/Objecter.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index d184b446b36..b208254eba6 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -2663,7 +2663,15 @@ int Objecter::_calc_target(op_target_t *t, epoch_t *last_force_resend, t->osd = -1; return RECALC_OP_TARGET_POOL_DNE; } - pgid = osdmap->raw_pg_to_pg(t->base_pgid); + if (osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)) { + // if the SORTBITWISE flag is set, we know all OSDs are running + // jewel+. + pgid = t->base_pgid; + } else { + // legacy behavior. pre-jewel OSDs will fail if we send a + // full-hash pgid value. + pgid = osdmap->raw_pg_to_pg(t->base_pgid); + } } else { int ret = osdmap->object_locator_to_pg(t->target_oid, t->target_oloc, pgid);