]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Pipe: encode message inside pipe_lock
authorSage Weil <sage@inktank.com>
Sun, 6 Jan 2013 16:25:40 +0000 (08:25 -0800)
committerSage Weil <sage@inktank.com>
Mon, 7 Jan 2013 04:38:28 +0000 (20:38 -0800)
This modifies bufferlists in the Message struct, and it is possible
for multiple instances of the Pipe to get references on the Message;
make sure they don't modify those bufferlists concurrently.

Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Pipe.cc

index aacc0109496c0dd6b2c170616a9f1fb15dc1c1bb..27d211cf59e63a8bbb1e6228ca3ba209ec0a919d 100644 (file)
@@ -1470,13 +1470,13 @@ void Pipe::writer()
        // 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);
 
+       pipe_lock.Unlock();
+
         ldout(msgr->cct,20) << "writer sending " << m->get_seq() << " " << m << dendl;
        int rc = write_message(m);