From nobody Wed Sep 06 12:28:50 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RghW65768z4rv1F; Wed, 6 Sep 2023 12:28:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RghW64dm0z3JPn; Wed, 6 Sep 2023 12:28:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694003330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FmAC1/2UxDaP8S9/uoAJYoYFu7eaXZy6D0wkt5VstoM=; b=wcywX8IbTq31zDpgItCUpEa8e7nzuCMT+eESwbs1OuHPk7Dns1du+pE+WuC1pxRICLjcCB h+NUJRDeWszN8hXnKkIUjgVHWMyj8GDNCsFw+G0NHnXlYAMaUO+J38uhw0oYAs1lvNOIEd 9O3tFklpPaK3zT6ChGv00vdNiYplYTn0Vj4ls4+M8aSXjiPTvxVLbTISI0JiJqEzBhszfE ZXTLNXIqm5t1LYrvF7SyVP9Ju0FEK+5OUK0bRbvfpWM+vsaksQx/6OvsE8x+wMP/uf9Rq5 r7fu1vBlzH6AuEo3vzr3wyYbI0Hbb1B2L5Tsvg0Vonmllpq9z795UAq/QCAs8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694003330; a=rsa-sha256; cv=none; b=gk2Jpaf9OgVQhiG97P3G7KRUGHbAAutnxEq4w+4lkFCIGhzAD1pilmlJZGwmZaqWku4heT lvuRJhfYGMiDkgaAd8mHqAOA9XjVwaBJNzjkN2MQT2hibs6B4pOHYNgTv4lZpzBh1ULHuR 9UzfZ6JMpqdZyK9Ejj5OOdH3ORhn7SQIGxObvLWfzDGnj5qKzZ1mVfbmt1aLkytbfXLNXS S+sFzs/wdPlGMCXP9A/FOuXO188QMeAy/AiDv1eC1VebPtcsuQry2qfR1Jivf/2CI3gyRC MdoUQZQD8DmNhwUwzepol+Wy4Hb7LqGEd6GHa+JfCHihmWhgUO637PlzPVL+0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694003330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FmAC1/2UxDaP8S9/uoAJYoYFu7eaXZy6D0wkt5VstoM=; b=ZIpz9TXrlhuazid4fVFGFj9U+zQb7kOjp303meusRyfqayHB3V2SJjaTt6WaHbQbQPx8qO qGR+vd8cl/f8Ky5w+cNroHts1UPIU53CO+Uith8BvAp9kZQwl9AJZ7Zm3jozxEcVwnz4xw towThPfvODDans/U4e5N2Fxf9sW7dak6KAn59uVGhHLK+UmxcWgkXiIFO+qAwcqWVUmlXc CebiCj5ICHcgmD2SsdkEDJ9jWIJZxopbrLCUxAojIwodWHytO3VLarLZsClrE+3QnhEIVC ABoJ+k9v34vZKrr3cwZe2n4vi3sCnKD+yxNN8NSj9a2FNy/cgUeNYisElsSQGw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RghW63k6Cz1rg; Wed, 6 Sep 2023 12:28:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 386CSolR071291; Wed, 6 Sep 2023 12:28:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 386CSoYT071288; Wed, 6 Sep 2023 12:28:50 GMT (envelope-from git) Date: Wed, 6 Sep 2023 12:28:50 GMT Message-Id: <202309061228.386CSoYT071288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 969071be938c - main - vfs: copy_file_range() between multiple mountpoints of the same fs type List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 969071be938ca9b96f8dff003c7b43d6308849f1 Auto-Submitted: auto-generated The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=969071be938ca9b96f8dff003c7b43d6308849f1 commit 969071be938ca9b96f8dff003c7b43d6308849f1 Author: Martin Matuska AuthorDate: 2023-09-06 11:58:10 +0000 Commit: Martin Matuska CommitDate: 2023-09-06 12:28:23 +0000 vfs: copy_file_range() between multiple mountpoints of the same fs type VOP_COPY_FILE_RANGE(9) is now caled when source and target vnodes reside on the same filesystem type (not just on the same mountpoint). The check if vnodes are on the same mountpoint must be done in the filesystem code. There are currently only three users - fusefs(5) already has this check, ZFS can handle multiple mountpoints and a check has been added to NFS client. ZFS block cloning is now possible between all snapshots and datasets of the same ZFS pool. MFC after: 1 week Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D41721 --- share/man/man9/VOP_COPY_FILE_RANGE.9 | 4 ++-- sys/fs/nfsclient/nfs_clvnops.c | 7 +++++-- sys/kern/vfs_vnops.c | 8 +++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/share/man/man9/VOP_COPY_FILE_RANGE.9 b/share/man/man9/VOP_COPY_FILE_RANGE.9 index 9243210cb265..aa17670954f4 100644 --- a/share/man/man9/VOP_COPY_FILE_RANGE.9 +++ b/share/man/man9/VOP_COPY_FILE_RANGE.9 @@ -28,8 +28,8 @@ .Os .Sh NAME .Nm VOP_COPY_FILE_RANGE -.Nd copy a byte range from one file to another or within one file -in a single file system +.Nd copy a byte range within a file or from one file to another in a single +file system or between multiple file systems .Sh SYNOPSIS .In sys/param.h .In sys/vnode.h diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 1fa287a79a84..383d45ba260b 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3898,8 +3898,11 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap) off_t inoff, outoff; bool consecutive, must_commit, tryoutcred; - /* NFSv4.2 Copy is not permitted for infile == outfile. */ - if (invp == outvp) { + /* + * NFSv4.2 Copy is not permitted for infile == outfile. + * TODO: copy_file_range() between multiple NFS mountpoints + */ + if (invp == outvp || invp->v_mount != outvp->v_mount) { generic_copy: return (vn_generic_copy_file_range(invp, ap->a_inoffp, outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags, diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 9fb5aee6a023..4e4161ef1a7f 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3076,12 +3076,14 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp, goto out; /* - * If the two vnode are for the same file system, call + * If the two vnodes are for the same file system type, call * VOP_COPY_FILE_RANGE(), otherwise call vn_generic_copy_file_range() - * which can handle copies across multiple file systems. + * which can handle copies across multiple file system types. */ *lenp = len; - if (invp->v_mount == outvp->v_mount) + if (invp->v_mount == outvp->v_mount || + strcmp(invp->v_mount->mnt_vfc->vfc_name, + outvp->v_mount->mnt_vfc->vfc_name) == 0) error = VOP_COPY_FILE_RANGE(invp, inoffp, outvp, outoffp, lenp, flags, incred, outcred, fsize_td); else