]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Pipe: associate sending msgs to con inside lock
authorSage Weil <sage@inktank.com>
Sat, 5 Jan 2013 18:39:08 +0000 (10:39 -0800)
committerSage Weil <sage@inktank.com>
Mon, 7 Jan 2013 21:08:23 +0000 (13:08 -0800)
Associate a sending message with the connection inside the pipe_lock.
This way if a racing thread tries to steal these messages it will
be sure to reset the con point *after* we do such that it the con
pointer is valid in encode_payload() (and later).

This may be part of #3678.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit a058f16113efa8f32eb5503d5443aa139754d479)

src/msg/Pipe.cc

index 1a0379e4f79717c94619b7a923df3ea9bb4d2640..fa7763754ff959296a6a21f351e9745e9b296921 100644 (file)
@@ -1409,13 +1409,14 @@ void Pipe::writer()
          sent.push_back(m); 
          m->get();
        }
-       pipe_lock.Unlock();
-
-        ldout(msgr->cct,20) << "writer encoding " << m->get_seq() << " " << m << " " << *m << dendl;
 
        // associate message with Connection (for benefit of encode_payload)
        m->set_connection(connection_state->get());
 
+       pipe_lock.Unlock();
+
+        ldout(msgr->cct,20) << "writer encoding " << m->get_seq() << " " << m << " " << *m << dendl;
+
        // encode and copy out of *m
        m->encode(connection_state->get_features(), !msgr->cct->_conf->ms_nocrc);