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:03:55 +0000 (13:03 -0400)
commit325933efee696f007b1981ac676ed7c8753b4cd2
tree0a56f217e97cb9eb288ca4a3a421f8394eef2a4d
parent089721695e5fb8b515a322d8afc5b9eaa52a5981
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.024703 seconds and 4 git commands to generate.