From 1c4670fc9fbe1a405e3896610cbc81a57eb6aefc Mon Sep 17 00:00:00 2001 From: Mingxin Liu Date: Fri, 5 Jan 2018 18:00:36 +0800 Subject: [PATCH] osd: use next_map to determine if peer is down or peer was once down after this msg had been sent out Signed-off-by: Mingxin Liu (cherry picked from commit dc279bdd8675cf26a4517ac8399a84db510eb883) --- src/osd/OSD.h | 6 ++++++ src/osd/PG.cc | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.h b/src/osd/OSD.h index d60df55746019..c8731b8f9d707 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -519,6 +519,12 @@ public: } } } + OSDMapRef get_next_osdmap() { + Mutex::Locker l(pre_publish_lock); + if (!next_osdmap) + return OSDMapRef(); + return next_osdmap; + } private: Mutex peer_map_epoch_lock; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 289a97f2dedf4..7b9624267af23 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6207,14 +6207,15 @@ bool PG::can_discard_replica_op(OpRequestRef& op) // connection to it when handling the new osdmap marking it down, and also // resets the messenger sesssion when the replica reconnects. to avoid the // out-of-order replies, the messages from that replica should be discarded. - if (osd->get_osdmap()->is_down(from)) + OSDMapRef next_map = osd->get_next_osdmap(); + if (next_map->is_down(from)) return true; /* Mostly, this overlaps with the old_peering_msg * condition. An important exception is pushes * sent by replicas not in the acting set, since * if such a replica goes down it does not cause * a new interval. */ - if (get_osdmap()->get_down_at(from) >= m->map_epoch) + if (next_map->get_down_at(from) >= m->map_epoch) return true; // same pg? -- 2.39.5