git: 1d4e9d2b5ef5 - stable/14 - nfs_nfsdsocket.c: Allow Copy across file systems

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Sat, 11 Apr 2026 03:35:15 UTC
The branch stable/14 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=1d4e9d2b5ef5c8055740c949ad4446aed9a4d308

commit 1d4e9d2b5ef5c8055740c949ad4446aed9a4d308
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2026-03-28 19:39:10 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-04-11 03:33:19 +0000

    nfs_nfsdsocket.c: Allow Copy across file systems
    
    For some server file system types, such as ZFS, a Copy/Clone
    operation can be done across file systems of the same file
    system type.
    
    As such, this patch allows the Copy/Clone to be attempted
    when the file handles are for files on different file systems.
    
    This fixes a problem for exported ZFS file systems when a
    copy_files on file_range(2) between file systems in the same
    NFSv4 mount is attempted.
    
    PR:     294010
    
    (cherry picked from commit b65e7b4944cc2f594c9d9e6abc9b8618d3d62ff8)
---
 sys/fs/nfsserver/nfs_nfsdsocket.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c
index d1b6198ba0e1..81c224860cc0 100644
--- a/sys/fs/nfsserver/nfs_nfsdsocket.c
+++ b/sys/fs/nfsserver/nfs_nfsdsocket.c
@@ -1272,7 +1272,8 @@ tryagain:
 			if (vp == NULL || savevp == NULL) {
 				nd->nd_repstat = NFSERR_NOFILEHANDLE;
 				break;
-			} else if (fsidcmp(&cur_fsid, &save_fsid) != 0) {
+			} else if (fsidcmp(&cur_fsid, &save_fsid) != 0 &&
+			    op != NFSV4OP_COPY) {
 				nd->nd_repstat = NFSERR_XDEV;
 				break;
 			}