Tested from 2.6.17 - 2.6.20 64 bit kernels from kernel.org.
Results on reiserfs filesystem:
sendfile(3, 5, , 2097152) = 2097152
and on a CIFS filesystem:
sendfile(3, 5, , 2097152) = -1 EOVERFLOW (Value too large for defined data type)
At the same time, the recieving side reads the proper amount of data (I haven't tested for corruptions yet) and the offset (arg3) is updated to the correct value.
This would seem to indicate that it is in fact working, and the return path is picking up an error where it shouldn't. In addition, it's possibly confined to 64-bit kernels. (32/64 userspace makes no difference).
I tried looking at it, but got lost in the generic_mapped_read and FS callbacks there.
Same file data is used for both tests.
Created attachment 2393 [details]
Trivial sendfile(2) program
short test program that creates a socketpair and uses sendfile(2) across it.
Do you know if this still fails on current kernels?
Patch pushed upstream to fix this issue:
...it should make 2.6.31 and will likely be pushed to the stable kernel releases. Closing as FIXED.
Closing as FIXED -- please reopen if it's not working correctly with the proposed patch in place.