Fix: mmap write() for large subbuffers and handle EINTR (v2)
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 6 Jul 2012 14:13:05 +0000 (10:13 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 6 Jul 2012 17:00:36 +0000 (13:00 -0400)
commit47e81c0236926bdee0423bf3f1e6ad3f1facc364
tree8658247af8196cdffe2c67676602fc9717fdc8d2
parent6e7423591c5edde632d79ff52ba449d99da8eb14
Fix: mmap write() for large subbuffers and handle EINTR (v2)

With large subbuffer (packet) size, if write() returns before copying the
entire packet for mmap buffers, the consumerd restarts the write
infinitely, which is not good at all.

This affects both lttng-ust (in default mmap mode) and lttng-kernel (but
only for mmap buffers, which is not the default).

This issue would show up with large subbuffer size.

We need to handle this case, as well as EINTR errors (which need to restart
write).

Also fixing the return value of mmap read functions, which were returning
the amount of data written by the last invocation of write() rather than
the total number of bytes written. splice use had the same issue.

Also now consider a write() that returns more bytes than requested as an
error.

Moreover, assigning error = ret after failed splice and write was a
mistake: error is holding the actual error value. ret just holds -1.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/kernel-consumer/kernel-consumer.c
src/common/ust-consumer/ust-consumer.c
This page took 0.025131 seconds and 4 git commands to generate.