Skip to content

Commit

Permalink
objecter: don't lose reply codes when we wait_for_new_map
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Farnum committed Mar 18, 2010
1 parent 575d709 commit 3bd625c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions src/osdc/Objecter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,17 @@ void Objecter::handle_osd_map(MOSDMap *m)
if (osdmap->test_flag(CEPH_OSDMAP_FULL) & CEPH_OSDMAP_FULL)
maybe_request_map();

map<epoch_t,list<Context*> >::iterator p = waiting_for_map.begin();
//finish any Contexts that were waiting on a map update
map<epoch_t,list< pair< Context*, int > > >::iterator p =
waiting_for_map.begin();
while (p != waiting_for_map.end() &&
p->first <= osdmap->get_epoch()) {
finish_contexts(p->second);
//go through the list and call the onfinish methods
for (list<pair<Context*, int> >::iterator i = p->second.begin();
i != p->second.end(); ++i) {
i->first->finish(i->second);
delete i->first;
}
waiting_for_map.erase(p++);
}

Expand Down Expand Up @@ -731,7 +738,7 @@ void Objecter::handle_pool_op_reply(MPoolOpReply *m) {
last_seen_version = m->version;
if (osdmap->get_epoch() < m->epoch) {
dout(20) << "waiting for client to reach epoch " << m->epoch << " before calling back" << dendl;
wait_for_new_map(op->onfinish, m->epoch);
wait_for_new_map(op->onfinish, m->epoch, m->replyCode);
}
else {
op->onfinish->finish(m->replyCode);
Expand Down
6 changes: 3 additions & 3 deletions src/osdc/Objecter.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class Objecter {
map<tid_t,StatfsOp*> op_statfs;
map<tid_t,PoolOp*> op_pool;

map<epoch_t,list<Context*> > waiting_for_map;
map<epoch_t,list< pair<Context*, int> > > waiting_for_map;

/**
* track pending ops by pg
Expand Down Expand Up @@ -442,9 +442,9 @@ class Objecter {
int get_client_incarnation() const { return client_inc; }
void set_client_incarnation(int inc) { client_inc = inc; }

void wait_for_new_map(Context *c, epoch_t epoch) {
void wait_for_new_map(Context *c, epoch_t epoch, int replyCode=0) {
maybe_request_map();
waiting_for_map[epoch].push_back(c);
waiting_for_map[epoch].push_back(pair<Context *, int>(c, replyCode));
}

// mid-level helpers
Expand Down

0 comments on commit 3bd625c

Please sign in to comment.