]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: PeeringState: fix calc_replicated_acting_stretch() syntax/logic
authorGreg Farnum <gfarnum@redhat.com>
Thu, 11 Mar 2021 10:26:47 +0000 (10:26 +0000)
committerGreg Farnum <gfarnum@redhat.com>
Fri, 12 Mar 2021 20:58:52 +0000 (20:58 +0000)
There was a major error here! get_ancestor() was type-deduced to return
a bucket_candidates_t -- a *copy* of what was in the map, not the reference
to it we wanted to actually amend!

Fix this by returning a pointer instead. There's a way to coerce things
to return a reference instead but the syntax seems clumsier to me
and I'm not familiar with it anyway -- this works just fine.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/osd/PeeringState.cc

index fe1fa1a473252b8b50ff796793bebebf23f3f870..f1eaef1bfa235e5d1d88a3be358a170debb4e625 100644 (file)
@@ -1988,7 +1988,7 @@ void PeeringState::calc_replicated_acting_stretch(
       osd,
       pool.info.peering_crush_bucket_barrier,
       pool.info.crush_rule);
-    return ancestors[ancestor];
+    return &ancestors[ancestor];
   };
 
   unsigned bucket_max = pool.info.size / pool.info.peering_crush_bucket_target;
@@ -2005,7 +2005,7 @@ void PeeringState::calc_replicated_acting_stretch(
       want->push_back(osd);
       acting_backfill->insert(
        pg_shard_t(osd, shard_id_t::NO_SHARD));
-      get_ancestor(osd).inc_selected();
+      get_ancestor(osd)->inc_selected();
     }
   };
   add_required(primary->first.osd);
@@ -2064,7 +2064,7 @@ void PeeringState::calc_replicated_acting_stretch(
 
     // We then filter these candidates by ancestor
     std::for_each(candidates.begin(), candidates.end(), [&](auto cand) {
-      get_ancestor(cand.second).add_osd(cand.first, cand.second);
+      get_ancestor(cand.second)->add_osd(cand.first, cand.second);
     });
   }