Skip to content

Commit

Permalink
FreeBSD: Reduce copy_file_range() source lock to shared
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Alan Somers <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
Closes openzfs#16789
Closes openzfs#16797
  • Loading branch information
amotin authored and rkojedzinszky committed Dec 30, 2024
1 parent a9fc327 commit 28b7c7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -6095,7 +6095,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);
Expand Down

0 comments on commit 28b7c7f

Please sign in to comment.