From: Mingxin Liu Date: Fri, 5 Jan 2018 10:00:36 +0000 (+0800) Subject: osd: use next_map to determine if peer is down X-Git-Tag: v12.2.13~57^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c4670fc9fbe1a405e3896610cbc81a57eb6aefc;p=ceph.git 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) --- diff --git a/src/osd/OSD.h b/src/osd/OSD.h index d60df557460..c8731b8f9d7 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 289a97f2ded..7b9624267af 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?