From 7968b4539b364099020b49de4033e39f324d1f30 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 24 Feb 2017 11:05:25 -0800 Subject: [PATCH] ReplicatedBackend: clear pull source once we are done with it 68defc2b0561414711d4dd0a76bc5d0f46f8a3f8 factored out the clear_pull behavoir, but we actually need to clear the pull source in handle_pull_response (even though we don't clear the pulling entry until the callback) so that we don't clear the pulling entry in check_recovery_sources. This should restore the clearing behavior to basically what it was in kraken. Fixes: http://tracker.ceph.com/issues/19076 Signed-off-by: Samuel Just --- src/osd/ReplicatedBackend.cc | 22 +++++++++++++++------- src/osd/ReplicatedBackend.h | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 1ae2d0d0de9ce..ac2edee74fe39 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -883,7 +883,7 @@ struct C_ReplicatedBackend_OnPullComplete : GenContext { auto j = bc->pulling.find(i.hoid); assert(j != bc->pulling.end()); ObjectContextRef obc = j->second.obc; - bc->clear_pull(j); + bc->clear_pull(j, false /* already did it */); if (!bc->start_pushes(i.hoid, obc, h)) { bc->get_parent()->on_global_recover( i.hoid, i.stat); @@ -1813,11 +1813,12 @@ bool ReplicatedBackend::handle_pull_response( assert((data_included.empty() && data.length() == 0) || (!data_included.empty() && data.length() > 0)); - if (!pulling.count(hoid)) { + auto piter = pulling.find(hoid); + if (piter == pulling.end()) { return false; } - PullInfo &pi = pulling[hoid]; + PullInfo &pi = piter->second; if (pi.recovery_info.size == (uint64_t(-1))) { pi.recovery_info.size = pop.recovery_info.size; pi.recovery_info.copy_subset.intersection_of( @@ -1877,6 +1878,7 @@ bool ReplicatedBackend::handle_pull_response( if (complete) { pi.stat.num_objects_recovered++; + clear_pull_from(piter); to_continue->push_back({hoid, pi.stat}); get_parent()->on_local_recover( hoid, pi.recovery_info, pi.obc, t); @@ -2415,15 +2417,21 @@ void ReplicatedBackend::_failed_push(pg_shard_t from, const hobject_t &soid) clear_pull(pulling.find(soid)); } +void ReplicatedBackend::clear_pull_from( + map::iterator piter) +{ + auto from = piter->second.from; + pull_from_peer[from].erase(piter->second.soid); + if (pull_from_peer[from].empty()) + pull_from_peer.erase(from); +} + void ReplicatedBackend::clear_pull( map::iterator piter, bool clear_pull_from_peer) { - auto from = piter->second.from; if (clear_pull_from_peer) { - pull_from_peer[from].erase(piter->second.soid); - if (pull_from_peer[from].empty()) - pull_from_peer.erase(from); + clear_pull_from(piter); } get_parent()->release_locks(piter->second.lock_manager); pulling.erase(piter); diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index c4f40ae81c1a9..1df8e1493fb25 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -221,6 +221,8 @@ private: void clear_pull( map::iterator piter, bool clear_pull_from_peer = true); + void clear_pull_from( + map::iterator piter); void sub_op_push(OpRequestRef op); void sub_op_push_reply(OpRequestRef op); -- 2.47.3