From 56ba90f5e49d499ea9f6bda9665031ce90abdc32 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 23 Oct 2015 14:17:06 -0400 Subject: [PATCH] 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 --- src/osd/PG.cc | 16 ---------------- src/osd/ReplicatedPG.cc | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c6e2d38260f..634d8299a5e 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 2b4eb8b1c52..1b2c870bcb1 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); -- 2.47.3