Skip to content

Commit

Permalink
Merge pull request #1664 from ceph/wip-8085
Browse files Browse the repository at this point in the history
osd: handle misdirected pg command

Reviewed-by: Samuel Just <sam.just@inktank.com>
  • Loading branch information
Samuel Just committed Apr 14, 2014
2 parents a2323a6 + a72bcdd commit cab29ac
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/osd/OSD.cc
Expand Up @@ -4279,10 +4279,23 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
_have_pg(pcand)) {
PG *pg = _lookup_lock_pg(pcand);
assert(pg);
// simulate pg <pgid> cmd= for pg->do-command
if (prefix != "pg")
cmd_putval(cct, cmdmap, "cmd", prefix);
r = pg->do_command(cmdmap, ss, data, odata);
if (pg->is_primary()) {
// simulate pg <pgid> cmd= for pg->do-command
if (prefix != "pg")
cmd_putval(cct, cmdmap, "cmd", prefix);
r = pg->do_command(cmdmap, ss, data, odata);
} else {
ss << "not primary for pgid " << pgid;

// send them the latest diff to ensure they realize the mapping
// has changed.
send_incremental_map(osdmap->get_epoch() - 1, con);

// do not reply; they will get newer maps and realize they
// need to resend.
pg->unlock();
return;
}
pg->unlock();
} else {
ss << "i don't have pgid " << pgid;
Expand Down

0 comments on commit cab29ac

Please sign in to comment.