Re: NFSv4.2 READ_PLUS support?

From: Rob Norris <robn_at_despairlabs.com>
Date: Mon, 25 Aug 2025 01:36:51 UTC
On Sat, 23 Aug 2025, at 12:37 AM, Cedric Blancher wrote:
> Holes are not sequences of 0x00 bytes. Holes means "no data here". ZFS
> compression should preserve the sparse information, otherwise you turn
> ANY sequence of 0x00 bytes into holes,and that will break databases
> and other applications which depend on exactly that *precise*
> semantics.

This is the second time I've heard this on this list (previously[1]) but
I don't know what it's referring to. Can you give me a reference to
software that expects this or a doc that mandates it? If ZFS is truly
doing the wrong thing, or there's a substantial body of software out
there expecting it, then I'll look into whether or not we might want to
change the behaviour. Right now though, I don't know of anything that
suggests an application should be able to expect anything in particular
regarding holes/sparseness.

For avoidance of doubt, here's what I know. Everything I'm aware of says
that holes/"sparseness" is entirely up to the filesystem to decide, so
long as unallocated regions return zeroes when read from (POSIX
definition for hole[2] and sparse[3]). The filesystem can tell
applications about the presence of sparse regions if it wants to, but
the application shouldn't expect any holes except the virtual end-of-
file hole (POSIX lseek[4]).

Even the OS-specific calls related to holes and sparseness don't require
anything in particular. FreeBSD fspacectl(2)[5] defines SPACECTL_DEALLOC
as zeroing a range, and allows it to be serviced by hole punching but
doesn't require it. Linux fallocate(2)[6] FALLOC_FL_PUNCH_HOLE comes
closest to allowing an application to explicitly request a hole, but
even then allows for partial blocks in the range to be zeroed, and only
describes what subsequent reads should do.

So yeah, if you can point me at something I'll look into it further.

Cheers,
Rob.

1. https://marc.info/?l=freebsd-hackers&m=174714980505207&w=2
2. https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_169
3. https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_347
4. https://pubs.opengroup.org/onlinepubs/9799919799/functions/lseek.html
5. https://man.freebsd.org/cgi/man.cgi?query=fspacectl
6. https://www.man7.org/linux/man-pages/man2/fallocate.2.html