Skip to content

vfs_default: detect EOPNOTSUPP and ENOSYS errors from copy_file_range()

When building in a RHEL 7 container on a RHEL 8 host, the current configure check will detect a working SYS_copy_file_range() syscall.

Later when the resulting smbd binary is run in a RHEL 7 container on a RHEL 7 (vs 8 on the build host) host, SYS_copy_file_range() will fail with EOPNOTSUPP.

Since the kernel support for copy_file_range() included a fallback in case filesystems didn't implement it, the caching of copy_file_range() support can be made a global via the static try_copy_file_range bool, there's no need to deal with per-fileystem behaviour differences. For the curious: SYS_copy_file_range() appeared in Linux 4.5, fallback code being vfs_copy_file_range() -> do_splice_direct().

On current kernels the fallback function is generic_copy_file_range() (which still calls do_splice_direct()) called from the filesystem backends directly or from vfs_copy_file_range() -> do_copy_file_range().

Edited by Ralph Böhme

Merge request reports