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: v10.0.1~118^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6364%2Fhead;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 --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c6e2d38260fd..634d8299a5ea 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5012,22 +5012,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 2b4eb8b1c524..1b2c870bcb17 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1496,6 +1496,23 @@ void ReplicatedPG::do_op(OpRequestRef& 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);