diff --git a/io.c b/io.c index 24f721e..f282374 100644 --- a/io.c +++ b/io.c @@ -11114,8 +11114,18 @@ nogvl_copy_stream_func(void *arg) #ifdef USE_COPY_FILE_RANGE ret = nogvl_copy_file_range(stp); - if (ret != 0) - goto finish; /* error or success */ + if (ret == ENOSYS || err == EPERM) { + /* + * Containerized environment might not have this freshy syscall. + * Container users shouldn't run any userland requires the newer kernel than its host, + * but it's sometime impossible, so rescuing here. + * We may see EPERM when a process lacks some capabilities in Linux... + * https://bugs.ruby-lang.org/issues/14207 [ruby-dev:50376] + */ + } + else if (ret != 0) { + goto finish; /* error or success */ + } #endif #ifdef USE_SENDFILE