]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: possible race condition with connection reset 24276/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 25 Sep 2018 18:18:00 +0000 (14:18 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 25 Sep 2018 18:18:00 +0000 (14:18 -0400)
If the connection quickly fails before the private session reference
can be associated with the connection, the connection will remain
closed and any OSD ops against the session will remain stuck.

Fixes: http://tracker.ceph.com/issues/36183
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/osdc/Objecter.cc

index 1a85ed1b0cb75e97bc71715d92e98c86c863f44a..ed3a6597c01ddbccf3fbaf4a462df9233287da13 100644 (file)
@@ -1834,6 +1834,7 @@ void Objecter::get_session(Objecter::OSDSession *s)
 
 void Objecter::_reopen_session(OSDSession *s)
 {
+  // rwlock is locked unique
   // s->lock is locked
 
   auto addrs = osdmap->get_addrs(s->osd);
@@ -4386,12 +4387,13 @@ bool Objecter::ms_handle_reset(Connection *con)
   if (!initialized)
     return false;
   if (con->get_peer_type() == CEPH_ENTITY_TYPE_OSD) {
+    unique_lock wl(rwlock);
+
     auto priv = con->get_priv();
     auto session = static_cast<OSDSession*>(priv.get());
     if (session) {
       ldout(cct, 1) << "ms_handle_reset " << con << " session " << session
                    << " osd." << session->osd << dendl;
-      unique_lock wl(rwlock);
       if (!initialized) {
        wl.unlock();
        return false;