From ff8d703859005ca9e754a3555de9188d972dda7c Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Thu, 21 Nov 2024 19:15:16 -0500 Subject: [PATCH] FreeBSD: Reduce copy_file_range() source lock to shared Linux locks copy_file_range() source as shared. FreeBSD was doing it also, but then was changed to exclusive, partially because KPI of that time was doing so, and partially seems out of caution. Considering zfs_clone_range() uses range locks on both source and destination, neither should require exclusive vnode locks. But one step at a time, just sync it with Linux for now. Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. Closes #16789 --- module/os/freebsd/zfs/zfs_vnops_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/os/freebsd/zfs/zfs_vnops_os.c b/module/os/freebsd/zfs/zfs_vnops_os.c index e5acd684ee6b..629cc2216221 100644 --- a/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/module/os/freebsd/zfs/zfs_vnops_os.c @@ -6198,7 +6198,7 @@ zfs_freebsd_copy_file_range(struct vop_copy_file_range_args *ap) } else { #if (__FreeBSD_version >= 1302506 && __FreeBSD_version < 1400000) || \ __FreeBSD_version >= 1400086 - vn_lock_pair(invp, false, LK_EXCLUSIVE, outvp, false, + vn_lock_pair(invp, false, LK_SHARED, outvp, false, LK_EXCLUSIVE); #else vn_lock_pair(invp, false, outvp, false);