aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2023-11-12 18:29:14 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2023-11-20 01:40:34 +0000
commit02c8fefba6b1be95cd738694a616454251a7c709 (patch)
tree6976696ca80b9b8c15cf605e151e55c2d3890b22
parent26c99c95ccfa59091e30715a86f389a072fa6c11 (diff)
downloadsrc-02c8fefba6b1be95cd738694a616454251a7c709.tar.gz
src-02c8fefba6b1be95cd738694a616454251a7c709.zip
vn_copy_file_range(): use local variables for invp/outvp vnodes v_mounts
(cherry picked from commit 89188bd6ba8d8332c65498f2b71c90e5ed4b9dae)
-rw-r--r--sys/kern/vfs_vnops.c6
1 files changed, 5 insertions, 1 deletions
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