openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.68k stars 1.76k forks source link

FreeBSD: Reduce copy_file_range() source lock to shared #16797

Closed amotin closed 2 days ago

amotin commented 3 days ago

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.

Closes #16789

How Has This Been Tested?

Passes fsx test from https://github.com/openzfs/zfs/issues/16789, even though https://github.com/openzfs/zfs/pull/16796 should be the proper fix.

Types of changes

Checklist:

amotin commented 3 days ago

But was it your intention that either this PR or #16796 alone should fix the panic?

No, not really. I thought that shared lock recursion should be less of a problem, and IIRC it passed some tests for me, but I don't insist on it.