diff --git a/share/man/man9/VOP_COPY_FILE_RANGE.9 b/share/man/man9/VOP_COPY_FILE_RANGE.9 --- 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 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3898,8 +3898,11 @@ 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 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3076,12 +3076,14 @@ 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