From nobody Thu Sep 07 07:40:01 2023 X-Original-To: dev-commits-src-all@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 4RhB3Q0rrNz4s4vV; Thu, 7 Sep 2023 07:40:02 +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 4RhB3P6gTQz3DkQ; Thu, 7 Sep 2023 07:40:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694072401; 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=0inK4Ql4AGDo2+uUpa6tuTdXmhPOtsyvLvlUjFsf5Vc=; b=yhck6qrpROCAYX4N1cFJRs9sx0USmiX+cOvvxba03jNBDEs/M5vPazlwEVoZ95OVk1vQjy wYw9zg2BVxabze2b0j4rMtBuqkOiZNjwXAgHN4ZHz6mH70BfXdA2XfaM0ON/nUOnY9cf4Y VcGVKf/OsjZI7WxyTur8ZnvTqxvg3rXT7+PmW/eEYt6pljR2GPKp1KKdaieQyLhTnfOGBX JfszCvjb5CAzrn8TZDo3mFSBcKxDPvpuxqATWYG7F2kZ6AyvcBRzbQ1j7gidSgvrnvyN0V VTocbNbBhNnQSQNpAJvu6Kzr79aJwlMbnwDnfBW0z2y0J7BBA204gAFvppAi5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694072401; a=rsa-sha256; cv=none; b=KEl9B3fm0CiIva3H33MyCadwwzaFQ7fbIRXTDUoWiyMebHdJOSXReElqOxn/lgeBfXa1DC QVfnHXjrl2pivnPJCY0Skr9lGbgwPveA4aaeD6Aw4GlSmzx1s2qXb4IC522NFEzgluYEij 9UupbOL+yZGDZPcvUPIET88CcRCuzxGzYrY7EwZfc1X2skxcVBL4W+TyPEl3neYVWo2sly J30Rflk/SSrpVFrpWZ9dMJTA7IdgtIGhMnTQ5rioRFak286Ep22VErEU9v2Lt3Jux0/NZt gAmZwOKzLMNeq5UgwAySy62S2b0J6vKtLdsPMKId1lSsty9Vw+8k6hCvck1EbA== 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=1694072401; 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=0inK4Ql4AGDo2+uUpa6tuTdXmhPOtsyvLvlUjFsf5Vc=; b=eNfwDgs5kuLqq2U+e532/V3HEDXku/iqef3mWig7PeYzfGu48Fz5VlA27X9HRGI2t07A88 L6L/h5wbU7hUI+PDo5inHpK0SFxdLSnxHm3Q/lCFrjG5XQLuR5DhB1zWky2LkXsWnWt9bg LAwAnpcQ+rL2vWlNg/ODMCiPBXO4QExPX228Z1+Z91EMfOBB+kPmp+9sqXzVMpoP7kRoGk wULGawJ81FhDJXjIp9BYYj8gQk+r73dN3xFVEAeKHF35EAIE+US9o9xHPTuFpwAs4Bopyl RSYHsD54bcOxcW+Q0JGeiCBBfx/1Qwtgn0JzIJviqHhwuOkV4HG8S5ZUwQgwzg== 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 4RhB3P5jyLzqnX; Thu, 7 Sep 2023 07:40:01 +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 3877e1Wv088718; Thu, 7 Sep 2023 07:40:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3877e1Ig088711; Thu, 7 Sep 2023 07:40:01 GMT (envelope-from git) Date: Thu, 7 Sep 2023 07:40:01 GMT Message-Id: <202309070740.3877e1Ig088711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 60b37f216180 - stable/14 - vfs: copy_file_range() between multiple mountpoints of the same fs type List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 60b37f2161800f5b7e46ea8a0dd6d33aa4db5cd4 Auto-Submitted: auto-generated The branch stable/14 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=60b37f2161800f5b7e46ea8a0dd6d33aa4db5cd4 commit 60b37f2161800f5b7e46ea8a0dd6d33aa4db5cd4 Author: Martin Matuska AuthorDate: 2023-09-06 11:58:10 +0000 Commit: Martin Matuska CommitDate: 2023-09-07 07:39:40 +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. This is an early MFC due to release schedule. Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D41721 Approved by: re (gjb) (cherry picked from commit 969071be938ca9b96f8dff003c7b43d6308849f1) --- 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