git: 6dddd2503fc7 - stable/15 - nfs_nfsdsocket.c: All Copy and Clone across file systems

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

URL: https://cgit.FreeBSD.org/src/commit/?id=6dddd2503fc71b6e192b198209cdcd81b1b04fa8

commit 6dddd2503fc71b6e192b198209cdcd81b1b04fa8
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2026-03-28 19:39:10 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-04-11 00:57:08 +0000

    nfs_nfsdsocket.c: All Copy and Clone 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 636c4735a131..d6cfdb6b9c8e 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 && op != NFSV4OP_CLONE) {
 				nd->nd_repstat = NFSERR_XDEV;
 				break;
 			}