We don’t support querying for posix_falloc support at the filesystem level, but we probably should. Here’s the Austin bug from 2013 for reference: http://austingroupbugs.net/view.php?id=687 . Here’s one part of where it should be supported: https://svnweb.freebsd.org/base/head/sys/sys/unistd.h?revision=306651
FYI: lld is now broken on zfs because it use fallocate. I had this happen for a amd64 -> aarch64 cross buildworld where it refused to try to deal with making a libc.so.7.full file. llvm has the code (note the EOPNOTSUPP use): std::error_code resize_file(int FD, uint64_t Size) { #if defined(HAVE_POSIX_FALLOCATE) // If we have posix_fallocate use it. Unlike ftruncate it always allocates // space, so we get an error if the disk is full. if (int Err = ::posix_fallocate(FD, 0, Size)) { if (Err != EOPNOTSUPP) return std::error_code(Err, std::generic_category()); } #endif // Use ftruncate as a fallback. It may or may not allocate space. At least on // OS X with HFS+ it does. if (::ftruncate(FD, Size) == -1) return std::error_code(errno, std::generic_category()); return std::error_code(); } See, for example, https://lists.freebsd.org/pipermail/freebsd-toolchain/2017-November/003413.html for other details that lead to the eventual error message from lld. I reverted to using devel/aarch64-binutils for now.
(In reply to Mark Millard from comment #1) Note: I'm not sure I can self host a buildworld involving lld on amd64 at this point: lld is likely broken in the same way as the cross compiler was, as of when I jumped to: # uname -apKU FreeBSD FreeBSDx64OPC 12.0-CURRENT FreeBSD 12.0-CURRENT r325369M amd64 amd64 1200052 1200052 from before the disabling of fallocate. I may have to use binutils to do the next update.
(In reply to Mark Millard from comment #1) Please file a separate bug for this. Thanks!
(In reply to Ngie Cooper from comment #3) Done. Bugzilla 223440 notes lld and possibly more in world that needs review and possible adjustment. Ed Maste already has a patch on the lists for llvm in order for lld to be well behaved. See: https://lists.freebsd.org/pipermail/freebsd-current/2017-November/067432.html It fixed the problem that I saw. I do not know if any of the existing use would ever be adjusted to use what is proposed here or not. It does not seem likely for the llvm code involved in lld: Ed's change looks appropriate to that context to me.
A commit references this bug: Author: emaste Date: Sun Nov 5 00:51:53 UTC 2017 New revision: 325420 URL: https://svnweb.freebsd.org/changeset/base/325420 Log: lld: accept EINVAL to indicate posix_fallocate is unsupported As of r325320 posix_fallocate on a ZFS filesystem returns EINVAL to indicate that the operation is not supported. (I think this is a strange choice of errno on the part of POSIX.) PR: 223383, 223440 Reported by: Mark Millard Tested by: Mark Millard MFC after: 3 days Sponsored by: The FreeBSD Foundation Changes: head/contrib/llvm/lib/Support/Unix/Path.inc
Note that POSIX has not yet settled on a pathconf() variable for fallocate. That link is just a discussion, but we can't implement it until they decide to adopt something.
A commit references this bug: Author: emaste Date: Wed Nov 8 00:39:04 UTC 2017 New revision: 325523 URL: https://svnweb.freebsd.org/changeset/base/325523 Log: MFC r325420: lld: accept EINVAL to indicate posix_fallocate is unsupported As of r325320 posix_fallocate on a ZFS filesystem returns EINVAL to indicate that the operation is not supported. (I think this is a strange choice of errno on the part of POSIX.) PR: 223383, 223440 Reported by: Mark Millard Sponsored by: The FreeBSD Foundation Changes: _U stable/11/ stable/11/contrib/llvm/lib/Support/Unix/Path.inc
Unassign: I fixed up the problem reported by Mark Millard in this PR but am not currently working on pathconf.
A commit references this bug: Author: brooks Date: Sun Nov 12 09:09:35 UTC 2017 New revision: 454025 URL: https://svnweb.freebsd.org/changeset/ports/454025 Log: Merge from src: lld: accept EINVAL to indicate posix_fallocate is unsupported As of r325320 posix_fallocate on a ZFS filesystem returns EINVAL to indicate that the operation is not supported. (I think this is a strange choice of errno on the part of POSIX.) PR: 223383, 223440 Reported by: Mark Millard Changes: head/devel/llvm50/Makefile head/devel/llvm50/files/patch-lib_Support_Unix_Path.inc
(In reply to commit-hook from comment #9) Thank you!
(In reply to commit-hook from comment #9) Note: I reported devel/llvm50 but I do not have devel/llvm40 or earlier installed to test. I'd not be surprised if a large range of: devel/llvm* were broken on zfs after the fallocate fix for zfs.
devel/llvm40 could probably make effective use of the change (if the issue also exists there). On earlier versions LLD is probably not usable enough to worry.
A commit references this bug: Author: brooks Date: Mon Nov 13 01:45:13 UTC 2017 New revision: 454093 URL: https://svnweb.freebsd.org/changeset/ports/454093 Log: Merge from src and upstream LLVM: lld: accept EINVAL to indicate posix_fallocate is unsupported As of r325320 posix_fallocate on a ZFS filesystem returns EINVAL to indicate that the operation is not supported. (I think this is a strange choice of errno on the part of POSIX.) PR: 223383, 223440 Reported by: Mark Millard Changes: head/devel/llvm40/Makefile head/devel/llvm40/files/patch-lib_Support_Unix_Path.inc
llvm40 and llvm50 had the issue. llvm39 does not include posix_fallocate() use and I assume earlier versions do not as well. I'll be updating llvm-devel to pick up the fix from upstream and patching llvm-cheri* soon.
A commit references this bug: Author: brooks Date: Mon Nov 13 02:47:52 UTC 2017 New revision: 454097 URL: https://svnweb.freebsd.org/changeset/ports/454097 Log: Update to a new snapshot. This includes the fix for posix_fallocate not being supported on ZFS. PR: 223383, 223440 Reported by: Mark Millard Changes: head/devel/llvm-devel/Makefile head/devel/llvm-devel/Makefile.snapshot head/devel/llvm-devel/distinfo head/devel/llvm-devel/pkg-plist
A commit references this bug: Author: brooks Date: Thu Nov 16 21:44:19 UTC 2017 New revision: 454342 URL: https://svnweb.freebsd.org/changeset/ports/454342 Log: Update to a new snapshot and apply the patch for posix_fallocate() support being remove for ZFS PR: 223383, 223440 Sponsored by: DARPA, AFRL Changes: head/devel/llvm-cheri/Makefile head/devel/llvm-cheri/Makefile.snapshot head/devel/llvm-cheri/distinfo head/devel/llvm-cheri/files/gen-Makefile.snapshot.sh head/devel/llvm-cheri/files/patch-lib_Support_Unix_Path.inc head/devel/llvm-cheri/pkg-plist
^Triage: committed several years ago.