As part of the diagnostics it was suggested that sendfile count should not be larger that the file to be sent.
It has not fixed the issue with sendfile and 5.16 under zfs but is perhaps more correct than the current code and should not trigger the following case should the kernel maintainers decide to implement this error.
EOVERFLOW
count is too large, the operation would result in exceeding the maximum size of either the input file or the output file.
Thanks! I'm not sure why I originally used MAX_SENDFILE_COUNT even if the file is smaller, but even apart from the behavior in zfs, the code in your PR makes more sense than the original code.
There is an issue with sendfile returning EINVAL under linux 5.16 with zfs https://github.com/openzfs/zfs/issues/12971
As part of the diagnostics it was suggested that sendfile count should not be larger that the file to be sent. It has not fixed the issue with sendfile and 5.16 under zfs but is perhaps more correct than the current code and should not trigger the following case should the kernel maintainers decide to implement this error.
flexo.strace.5.15.txt flexo.strace.5.16.txt