From nobody Tue Dec 05 00:54:57 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 4Skhrx4V3Hz533GD; Tue, 5 Dec 2023 00:54:57 +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 4Skhrx3jyVz4fr6; Tue, 5 Dec 2023 00:54:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701737697; 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=ufdyKhAUDXvQNVjC/1ummreqrILzKuNC2COtazkR9Pg=; b=w0TRjMPrcvZTbTGiIYx8XJ5Ya13P0eb3EkyA8wTgKgks2fm9xmj7/we3cZTGMY7xWTKjkp 8ntBkec4wImUq4eg9XdrkPEI/ytuhJUc7TPJALSTe16VZ9F2WKxHIMj8AUqG+eoV8PEkxI EpCPuWGJyXHCM+AT1JjFv7QRgdP5BQ8dA62q8pA2feUVpOiJDlS8Oov2TXmprTqVbZzKLc uikwzOxbwPT46XoDatBRwyXH720pM/iEEmEMuWY9FHub31e22izhNels2OsXmY/ZV0aRva 7H42KHxnR3lZmBgM3wGKozBHOASF4bP4RDAEMUH3/OGT0i7K12XpnKC82ftzrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701737697; 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=ufdyKhAUDXvQNVjC/1ummreqrILzKuNC2COtazkR9Pg=; b=Ltt9DU7c+rUGma1iziMtKWJ/fSgAISbZZeR6SRCYI/8bnu1j9GUuwD4Uq5080LptsqcZhu rn1hT5uoo7kl3yH/g8yZL+Qk9aZKvuywVNu/fje+KuCcDFpc2urkgXf7yo5rGt/YtIAn9w JqveJWQN9dmeq0IJ5Eml5C5h5NS5t65UYUz6LOcYzBpnOAP75FrWE6SNgJcr3eqI2TO1p/ gq25gwrppNJnV3xL3TsZBD/JzyBT7uUoz5wPZ79TLM1Kf4PTB8sv/Xi0sD3xsBG0rNDVOo Wl6RcPUVPCJPA0TrZFlO3AfnINu7s9YFT7/92nS6E7zuGLJvyyR92SHaVpLilA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701737697; a=rsa-sha256; cv=none; b=Q5SrLd3j5WWnRYrYXeRemUTVMfevhDrEHRjjLKVe4VOnlwTCYWVf42/94EXofj74c2UCVX TsBrlmjW0TXDEojRr9tHs/Rwd54P/Cb7L3bydX60EDgxd+ZPCeyqEyGrbci/hDK8UwPf/f qiK47sr6l1wDRVkI3jW3oHEFmx9dX9bTQqlQesY5sGXHHL/MdofDc1XkxfhOrI2jHpo1TL jMdpqRxm4KO4alFN26k12dNWGm9jabeFpPB36VW3AIi5ScFFwzcQ2Si+caFtg0/yfemHO4 qLIUTl3lojvwkrJfGGy93PQiPUW0l3PHQkncKdouPEQQnbWqB3DF9RNx8KdoPA== 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 4Skhrx2pm2zpdS; Tue, 5 Dec 2023 00:54:57 +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 3B50svOb046787; Tue, 5 Dec 2023 00:54:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B50sv8u046785; Tue, 5 Dec 2023 00:54:57 GMT (envelope-from git) Date: Tue, 5 Dec 2023 00:54:57 GMT Message-Id: <202312050054.3B50sv8u046785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 045d603aa158 - stable/13 - vn_copy_file_range(): find write vnodes on which to call the VOP 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 045d603aa1580752d5c7a9a8c6021e4dddd7d8b2 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=045d603aa1580752d5c7a9a8c6021e4dddd7d8b2 commit 045d603aa1580752d5c7a9a8c6021e4dddd7d8b2 Author: Konstantin Belousov AuthorDate: 2023-11-18 08:57:44 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-05 00:44:13 +0000 vn_copy_file_range(): find write vnodes on which to call the VOP (cherry picked from commit a9bc8637690ce29496650a41d3c25e225ed22e3d) --- sys/kern/vfs_vnops.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 48737be64beb..e37518ebaaa1 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3027,10 +3027,12 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp, struct ucred *outcred, struct thread *fsize_td) { struct mount *inmp, *outmp; + struct vnode *invpl, *outvpl; int error; size_t len; uint64_t uval; + invpl = outvpl = NULL; len = *lenp; *lenp = 0; /* For error returns. */ error = 0; @@ -3056,17 +3058,22 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp, if (len == 0) goto out; - inmp = invp->v_mount; - outmp = outvp->v_mount; - if (inmp == NULL || outmp == NULL) { - error = EBADF; + error = VOP_GETLOWVNODE(invp, &invpl, FREAD); + if (error != 0) goto out; - } + error = VOP_GETLOWVNODE(outvp, &outvpl, FWRITE); + if (error != 0) + goto out1; + + inmp = invpl->v_mount; + outmp = outvpl->v_mount; + if (inmp == NULL || outmp == NULL) + goto out2; for (;;) { error = vfs_busy(inmp, 0); if (error != 0) - goto out; + goto out2; if (inmp == outmp) break; error = vfs_busy(outmp, MBF_NOWAIT); @@ -3077,7 +3084,7 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp, vfs_unbusy(outmp); continue; } - goto out; + goto out2; } break; } @@ -3089,14 +3096,20 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp, */ *lenp = len; if (inmp == outmp) - error = VOP_COPY_FILE_RANGE(invp, inoffp, outvp, outoffp, + error = VOP_COPY_FILE_RANGE(invpl, inoffp, outvpl, outoffp, lenp, flags, incred, outcred, fsize_td); else - error = vn_generic_copy_file_range(invp, inoffp, outvp, + error = vn_generic_copy_file_range(invpl, inoffp, outvpl, outoffp, lenp, flags, incred, outcred, fsize_td); vfs_unbusy(outmp); if (inmp != outmp) vfs_unbusy(inmp); +out2: + if (outvpl != NULL) + vrele(outvpl); +out1: + if (invpl != NULL) + vrele(invpl); out: return (error); }