RFC: Should fspacectl() commit changes to stable storage?

From: Rick Macklem <rick.macklem_at_gmail.com>
Date: Tue, 07 Feb 2023 01:23:34 UTC
PR#269328 reports an issue related to fspacectl() being
mixed with mmap'd I/O.

When working on a fix for this for the NFS client, I realized that
"man fspacectl" does not clarify if the deallocation should commit
changes to stable storage before returning success.
vop_stddeallocate() currently does not do this so, if a machine
crashes immediately after fspacectl() returns success, the hole
may not be there when the machine reboots.

For POSIX writes, it is clear that recently written data may be
lost when a machine crashes/reboots and fsync(2) is used to
ensure the data is on stable storage and won't be lost when a
crash/reboot occurs.

The question is "Should fsync(2) be required to ensure a hole
punched by fspacectl(2) is not lost or should it be guaranteed
to not be lost when fspacectl(2) returns?
Since fspacectl(2) is FreeBSD specific and there is no standard,
it could be defined either way.

So, what do you think? rick