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 <dillaman@redhat.com>
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()
}
}
+ 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);