msg/Pipe: encode message inside pipe_lock

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>
This commit is contained in:
Sage Weil 2013-01-06 08:25:40 -08:00
parent a058f16113
commit 4cfc4903c6

View 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);