Skip to content

Commit

Permalink
Merge pull request #3731 from liewegas/wip-10834-giant
Browse files Browse the repository at this point in the history
osd: tolerate sessionless con in fast dispatch path

Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
ldachary committed Feb 17, 2015
2 parents ccb0914 + 734e9af commit 4178e32
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions src/osd/OSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,8 @@ PG *OSD::get_pg_or_queue_for_pg(const spg_t& pgid, OpRequestRef& op)
{
Session *session = static_cast<Session*>(
op->get_req()->get_connection()->get_priv());
assert(session);
if (!session)
return NULL;
// get_pg_or_queue_for_pg is only called from the fast_dispatch path where
// the session_dispatch_lock must already be held.
assert(session->session_dispatch_lock.is_locked());
Expand Down Expand Up @@ -5504,14 +5505,15 @@ void OSD::ms_fast_dispatch(Message *m)
}
OSDMapRef nextmap = service.get_nextmap_reserved();
Session *session = static_cast<Session*>(m->get_connection()->get_priv());
assert(session);
{
Mutex::Locker l(session->session_dispatch_lock);
update_waiting_for_pg(session, nextmap);
session->waiting_on_map.push_back(op);
dispatch_session_waiting(session, nextmap);
if (session) {
{
Mutex::Locker l(session->session_dispatch_lock);
update_waiting_for_pg(session, nextmap);
session->waiting_on_map.push_back(op);
dispatch_session_waiting(session, nextmap);
}
session->put();
}
session->put();
service.release_map(nextmap);
}

Expand All @@ -5521,10 +5523,12 @@ void OSD::ms_fast_preprocess(Message *m)
if (m->get_type() == CEPH_MSG_OSD_MAP) {
MOSDMap *mm = static_cast<MOSDMap*>(m);
Session *s = static_cast<Session*>(m->get_connection()->get_priv());
s->received_map_lock.Lock();
s->received_map_epoch = mm->get_last();
s->received_map_lock.Unlock();
s->put();
if (s) {
s->received_map_lock.Lock();
s->received_map_epoch = mm->get_last();
s->received_map_lock.Unlock();
s->put();
}
}
}
}
Expand Down Expand Up @@ -5729,13 +5733,15 @@ bool OSD::dispatch_op_fast(OpRequestRef& op, OSDMapRef& osdmap)
if (msg_epoch > osdmap->get_epoch()) {
Session *s = static_cast<Session*>(op->get_req()->
get_connection()->get_priv());
s->received_map_lock.Lock();
epoch_t received_epoch = s->received_map_epoch;
s->received_map_lock.Unlock();
if (received_epoch < msg_epoch) {
osdmap_subscribe(msg_epoch, false);
if (s) {
s->received_map_lock.Lock();
epoch_t received_epoch = s->received_map_epoch;
s->received_map_lock.Unlock();
if (received_epoch < msg_epoch) {
osdmap_subscribe(msg_epoch, false);
}
s->put();
}
s->put();
return false;
}

Expand Down Expand Up @@ -8186,7 +8192,7 @@ void OSD::handle_replica_op(OpRequestRef& op, OSDMapRef& osdmap)
op->send_map_update = should_share_map;
op->sent_epoch = m->map_epoch;
enqueue_op(pg, op);
} else if (should_share_map) {
} else if (should_share_map && m->get_connection()->is_connected()) {
C_SendMap *send_map = new C_SendMap(this, m->get_source(),
m->get_connection(),
osdmap, m->map_epoch);
Expand Down

0 comments on commit 4178e32

Please sign in to comment.