Date: Tue, 4 Apr 2023 09:43:17 +0000 From: Alexey Dokuchaev <danfe@freebsd.org> To: Poul-Henning Kamp <phk@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 643336549081 - main - If copy_file_range(2) fails with EXDEV, use fall-back. Message-ID: <ZCvxNeB0A0hDWa8j@FreeBSD.org> In-Reply-To: <202304040740.3347eiU8033699@gitrepo.freebsd.org> References: <202304040740.3347eiU8033699@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 04, 2023 at 07:40:44AM +0000, Poul-Henning Kamp wrote:
> commit 64333654908153cd8e2dcb408c57cc3e3c4f29af
>
> If copy_file_range(2) fails with EXDEV, use fall-back.
> ---
> bin/cp/utils.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bin/cp/utils.c b/bin/cp/utils.c
> index 8c1c350ff6f1..9794152ac724 100644
> --- a/bin/cp/utils.c
> +++ b/bin/cp/utils.c
> @@ -180,7 +180,7 @@ copy_file(const FTSENT *entp, int dne)
> if (use_copy_file_range) {
> wcount = copy_file_range(from_fd, NULL,
> to_fd, NULL, SSIZE_MAX, 0);
Interesting. After commit c98a764c681f, which changed bufsize to
SSIZE_MAX above, my ports tinderbox started to fail when copying
packages and they come out zero-sized at destination. I've tried
to write a simple example to reproduce it and file a PR, but the
bug was evasive, so I just reverted that commit locally.
May I ask how did you arrive at this fix below? Did you observe
something similar, or my issue has nothing to do with it?
> - if (wcount < 0 && errno == EINVAL) {
> + if (wcount < 0 && (errno == EINVAL || errno == EXDEV)) {
> /* Prob a non-seekable FD */
> use_copy_file_range = 0;
> }
./danfe
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZCvxNeB0A0hDWa8j>
