The branch, v4-15-test has been updated via 7c8ba49b2e9 libreplace: remove now unused USE_COPY_FILE_RANGE define via 681675b68c5 vfs_default: detect EOPNOTSUPP and ENOSYS errors from copy_file_range() from c5fbec5db03 s3:libsmb: close the temporary IPC$ connection in cli_full_connection()
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-test - Log ----------------------------------------------------------------- commit 7c8ba49b2e9d963deccdea5bc16a8f43e1ce9fcf Author: Ralph Boehme <s...@samba.org> Date: Thu Aug 12 18:31:40 2021 +0200 libreplace: remove now unused USE_COPY_FILE_RANGE define The only user was removed in the previous commit. We still need the preceeding checks however, based on that replace.c provides a copy_file_range() fallback. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14795 RN: copy_file_range() may fail with EOPNOTSUPP Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> Autobuild-User(master): Ralph Böhme <s...@samba.org> Autobuild-Date(master): Fri Aug 13 11:45:17 UTC 2021 on sn-devel-184 (cherry picked from commit 1641e6c528e027dbfff96a834b94a8654a03a168) Autobuild-User(v4-15-test): Jule Anger <jan...@samba.org> Autobuild-Date(v4-15-test): Mon Aug 16 07:39:08 UTC 2021 on sn-devel-184 commit 681675b68c5dbbb4089067b2db9f11d69b2d085c Author: Ralph Boehme <s...@samba.org> Date: Thu Aug 12 18:23:21 2021 +0200 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(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14795 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> (cherry picked from commit c25f72f401842a18cab1db2bab89deec78274d93) ----------------------------------------------------------------------- Summary of changes: lib/replace/wscript | 2 -- source3/modules/vfs_default.c | 12 +++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/replace/wscript b/lib/replace/wscript index 12f995f3198..782ac5bd550 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -462,8 +462,6 @@ syscall(SYS_copy_file_range,0,NULL,0,NULL,0,0); ''', 'HAVE_SYSCALL_COPY_FILE_RANGE', msg='Checking whether we have copy_file_range system call') - if conf.CONFIG_SET('HAVE_COPY_FILE_RANGE') or conf.CONFIG_SET('HAVE_SYSCALL_COPY_FILE_RANGE'): - conf.DEFINE('USE_COPY_FILE_RANGE', 1) conf.SET_TARGET_TYPE('attr', 'EMPTY') diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index aa7dfe3192f..5701e37d5ec 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2214,10 +2214,11 @@ static NTSTATUS vfswrap_offload_copy_file_range(struct tevent_req *req) NTSTATUS status; bool same_file; bool ok; + static bool try_copy_file_range = true; -#ifndef USE_COPY_FILE_RANGE - return NT_STATUS_MORE_PROCESSING_REQUIRED; -#endif + if (!try_copy_file_range) { + return NT_STATUS_MORE_PROCESSING_REQUIRED; + } same_file = file_id_equal(&state->src_fsp->file_id, &state->dst_fsp->file_id); @@ -2286,6 +2287,11 @@ static NTSTATUS vfswrap_offload_copy_file_range(struct tevent_req *req) (intmax_t)state->remaining, strerror(errno)); switch (errno) { + case EOPNOTSUPP: + case ENOSYS: + try_copy_file_range = false; + status = NT_STATUS_MORE_PROCESSING_REQUIRED; + break; case EXDEV: status = NT_STATUS_MORE_PROCESSING_REQUIRED; break; -- Samba Shared Repository