From: Jason Dillaman Date: Fri, 23 Oct 2015 18:17:06 +0000 (-0400) Subject: osd: move misdirected op check from OSD thread to PG thread X-Git-Tag: v9.2.1~4^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0f5043975dbde75036b9f9e8be757494b8cdc73b;p=ceph.git osd: move misdirected op check from OSD thread to PG thread The op message isn't fully decoded until after the start of the PG op handling. Therefore, checking for misdirected ops needs to wait until after the RWM flags have been initialized. Fixes: #13491 Backport: infernalis Signed-off-by: Jason Dillaman (cherry picked from commit 56ba90f5e49d499ea9f6bda9665031ce90abdc32) Conflicts: src/osd/ReplicatedPG.cc In ReplicatedPG::do_op, resolved conflicts caused by afcfb050930e2e4086d631119022fd2dee9feb21 and 818d790f7d424520bc96c651571f2c86e94caf1e --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c13321c7b37a..17b29d607f7a 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5066,22 +5066,6 @@ bool PG::can_discard_op(OpRequestRef& op) return true; } - if ((m->get_flags() & (CEPH_OSD_FLAG_BALANCE_READS | - CEPH_OSD_FLAG_LOCALIZE_READS)) && - op->may_read() && - !(op->may_write() || op->may_cache())) { - // balanced reads; any replica will do - if (!(is_primary() || is_replica())) { - osd->handle_misdirected_op(this, op); - return true; - } - } else { - // normal case; must be primary - if (!is_primary()) { - osd->handle_misdirected_op(this, op); - return true; - } - } if (is_replay()) { if (m->get_version().version > 0) { dout(7) << " queueing replay at " << m->get_version() diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 7d5946b64e2b..00a84154b01e 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1488,6 +1488,24 @@ void ReplicatedPG::do_op(OpRequestRef& op) { MOSDOp *m = static_cast(op->get_req()); assert(m->get_type() == CEPH_MSG_OSD_OP); + + if ((m->get_flags() & (CEPH_OSD_FLAG_BALANCE_READS | + CEPH_OSD_FLAG_LOCALIZE_READS)) && + op->may_read() && + !(op->may_write() || op->may_cache())) { + // balanced reads; any replica will do + if (!(is_primary() || is_replica())) { + osd->handle_misdirected_op(this, op); + return; + } + } else { + // normal case; must be primary + if (!is_primary()) { + osd->handle_misdirected_op(this, op); + return; + } + } + if (op->includes_pg_op()) { if (pg_op_must_wait(m)) { wait_for_all_missing(op);