Skip to content

Commit

Permalink
osd: move misdirected op check from OSD thread to PG thread
Browse files Browse the repository at this point in the history
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: ceph#13491
Backport: infernalis
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Oct 23, 2015
1 parent 6528563 commit 56ba90f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/osd/PG.cc
Expand Up @@ -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()
Expand Down
17 changes: 17 additions & 0 deletions src/osd/ReplicatedPG.cc
Expand Up @@ -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);
Expand Down

0 comments on commit 56ba90f

Please sign in to comment.