Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 2023 01:41:43 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 02c8fefba6b1 - stable/13 - vn_copy_file_range(): use local variables for invp/outvp vnodes v_mounts
Message-ID:  <202311200141.3AK1fhbB050191@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=02c8fefba6b1be95cd738694a616454251a7c709

commit 02c8fefba6b1be95cd738694a616454251a7c709
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-11-12 18:29:14 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-11-20 01:40:34 +0000

    vn_copy_file_range(): use local variables for invp/outvp vnodes v_mounts
    
    (cherry picked from commit 89188bd6ba8d8332c65498f2b71c90e5ed4b9dae)
---
 sys/kern/vfs_vnops.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index dd3370bc33bb..5194d708f250 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -3026,6 +3026,7 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp,
     off_t *outoffp, size_t *lenp, unsigned int flags, struct ucred *incred,
     struct ucred *outcred, struct thread *fsize_td)
 {
+	struct mount *inmp, *outmp;
 	int error;
 	size_t len;
 	uint64_t uval;
@@ -3055,13 +3056,16 @@ 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 the two vnode are for the same file system, call
 	 * VOP_COPY_FILE_RANGE(), otherwise call vn_generic_copy_file_range()
 	 * which can handle copies across multiple file systems.
 	 */
 	*lenp = len;
-	if (invp->v_mount == outvp->v_mount)
+	if (inmp == outmp)
 		error = VOP_COPY_FILE_RANGE(invp, inoffp, outvp, outoffp,
 		    lenp, flags, incred, outcred, fsize_td);
 	else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202311200141.3AK1fhbB050191>