SEEK_DATA/SEEK_HOLE with vnode locked

From: Rick Macklem <rmacklem_at_uoguelph.ca>
Date: Wed, 10 Aug 2022 22:17:36 UTC
Hi,

When implementing what is called Read_Plus for the NFSv4.2
server, I need to do SEEK_DATA/SEEK_HOLE. However, if I
use VOP_IOCTL(), I need to unlock/relock the vnode.

This can result in problems if another RPC changes the size
of the file or allocates/deallocates data in the file while the
vnode is unlocked.

From what I can see, UFS does SEEK_DATA/SEEK_HOLE with
the vnode locked and ZFS doesn't seem to care/notice if it
is locked.
(Actually, ZFS looks like it might be unsafe, since it seems to
 assume it can use the unlocked vnode that might be doomed,
 but I do not know ZFS.)

Anyhow, does implementing a new vnode op VOP_SEEK(), which
takes a locked vnode and does SEEK_DATA/SEEK_HOLE sound
reasonable?

Thanks in advance for any info, rick