Skip to content

Commit

Permalink
Merge pull request #6629 from Abhishekvrshny/wip-13733-infernalis
Browse files Browse the repository at this point in the history
rbd: misdirected op in rbd balance-reads test

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
  • Loading branch information
Loic Dachary committed Feb 11, 2016
2 parents 4c04050 + 0f50439 commit a474c09
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/osd/OpRequest.cc
Expand Up @@ -84,6 +84,7 @@ void OpRequest::_unregistered() {
}

bool OpRequest::check_rmw(int flag) {
assert(rmw_flags != 0);
return rmw_flags & flag;
}
bool OpRequest::may_read() { return need_read_cap() || need_class_read_cap(); }
Expand Down
16 changes: 0 additions & 16 deletions src/osd/PG.cc
Expand Up @@ -5071,22 +5071,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
18 changes: 18 additions & 0 deletions src/osd/ReplicatedPG.cc
Expand Up @@ -1488,6 +1488,24 @@ void ReplicatedPG::do_op(OpRequestRef& op)
{
MOSDOp *m = static_cast<MOSDOp*>(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);
Expand Down

0 comments on commit a474c09

Please sign in to comment.