From 96ed2690dfb300033e48384704da6ec45737abee Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Thu, 2 Nov 2017 13:49:08 +0000 Subject: [PATCH] Disable posix_fallocate(2) for ZFS 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. MFC after: 3 weeks Sponsored by: Panzura --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index e9056cfab7e9..fc8bdb3103df 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -6009,6 +6009,7 @@ struct vop_vector zfs_vnodeops = { .vop_inactive = zfs_freebsd_inactive, .vop_reclaim = zfs_freebsd_reclaim, .vop_access = zfs_freebsd_access, + .vop_allocate = VOP_EINVAL, .vop_lookup = zfs_cache_lookup, .vop_cachedlookup = zfs_freebsd_lookup, .vop_getattr = zfs_freebsd_getattr,