[HEADS UP] posix_fallocate support removed from ZFS, lld affected

Andriy Gapon avg at FreeBSD.org
Mon Nov 6 15:40:30 UTC 2017

The naive and non-compliant support of posix_fallocate(2) in ZFS
has been removed as of r325320.  The system call now returns EINVAL
when used on a ZFS file.  Although the new behavior complies with the
standard, some consumers are not prepared to cope with it.
One known victim is lld prior to r325420.

>From https://svnweb.freebsd.org/changeset/base/325320
The generic (naive) implementation of posix_fallocate cannot provide the
standard mandated guarantee that overwrites would never fail due to the lack
of free space.  The fundamental reason is the copy-on-write architecture
of ZFS.  Other features like compression and deduplication can also
increase the size difference between the (pre-)allocated dummy content
and the future content.

So, until ZFS can properly implement the feature it's better to report
that it is unsupported rather than providing an ersatz implementation.
Please note that EINVAL is used to report that the underlying file system
does not support the operation (POSIX.1-2008).

illumos and ZoL seem to do the same.

lld is affected by the change.
That means that any world builds where lld is used are affected as well (if ZFS
is involved, of course).
One example is the arm64 build (typically a cross build from amd64).
The lld issue is fixed in head as of r325420.  But other branches are still
affected (if you are building them on a head kernel).

Other posix_fallocate consumers could be affected too.

Andriy Gapon

More information about the freebsd-fs mailing list