nfs-ganesha/nfs-ganesha — pull request #14 by sderr (2013-02-18 14:59:31+00:00)
Title: 9P/RDMA: Protect send buffers against early re-use

For 9P/RDMA, ganesha has two sets of buffers : recv and send buffers.
Each recv buffer is associated to a send buffer.
When a request is received on a recv buffer, it is processed and the associated
send buffer is used to send the reply.

But the current code fails to check that the previous message that was to be
sent using this send buffer has actually been sent and that this buffer can
be reused. In case of high traffic, this leads to buffer overwriting and
duplicate messages.

This patch adds a mutex to each buffer. Before processing a request, the mutex
is taken, and it will be released after the reply has been sent. If another request
wants to use the send buffer, it will have to wait for the message to be really
sent.