]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: possible race condition with connection reset 24574/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 25 Sep 2018 18:18:00 +0000 (14:18 -0400)
committerPrashant D <pdhange@redhat.com>
Sun, 14 Oct 2018 23:01:49 +0000 (01:01 +0200)
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>
(cherry picked from commit 74ca33cb49d2c258324447b1ca366ed4e604202a)

Conflicts:
src/osdc/Objecter.cc : Resolved in ms_handle_reset

src/osdc/Objecter.cc

index ddcf7a4c1659344ada573ddbaf893d4cba71ee1f..c93370ac249f4670d66c198a463bcb78b3796e7d 100644 (file)
@@ -1823,6 +1823,7 @@ void Objecter::get_session(Objecter::OSDSession *s)
 
 void Objecter::_reopen_session(OSDSession *s)
 {
+  // rwlock is locked unique
   // s->lock is locked
 
   entity_inst_t inst = osdmap->get_inst(s->osd);
@@ -4415,11 +4416,12 @@ bool Objecter::ms_handle_reset(Connection *con)
   if (!initialized)
     return false;
   if (con->get_peer_type() == CEPH_ENTITY_TYPE_OSD) {
+    unique_lock wl(rwlock);
+    
     OSDSession *session = static_cast<OSDSession*>(con->get_priv());
     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;