Summary: | world needs review and adjustment for the disabling of fallocate for zfs (-r325320), lld included | ||
---|---|---|---|
Product: | Base System | Reporter: | Mark Millard <marklmi26-fbsd> |
Component: | misc | Assignee: | Ed Maste <emaste> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | CC: | cy |
Priority: | --- | ||
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any | ||
See Also: | https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223383 |
Description
Mark Millard
2017-11-05 00:05:00 UTC
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 I have addressed one of the cases Mark identified (in lld), but the remainder still need to be reviewed. > contrib/sqlite3/sqlite3.c > crypto/heimdal/lib/sqlite/sqlite3.c AFAICT this is the only issue that needs more effort / investigation, as it appears that it does not correctly handle EINVAL or EOPNOTSUPP: #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE /* The code below is handling the return value of osFallocate() ** correctly. posix_fallocate() is defined to "returns zero on success, ** or an error number on failure". See the manpage for details. */ int err; do{ err = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size); }while( err==EINTR ); if( err ) return SQLITE_IOERR_WRITE; #else Other source files with posix_fallocate / fallocate do not have an issue: > contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c It's only testing that posix_fallocate doesn't change errno, and that EBADF is returned for a bad fd (-1), so no issue here. > contrib/llvm/lib/Support/Unix/Path.inc Fixed by r325420 > contrib/pjdfstest/pjdfstest.c Appears to be test harness only; I did not find a test invoking posix_fallocate or fallocate. 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 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 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 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 For bugs matching the following conditions: - Status == In Progress - Assignee == "bugs@FreeBSD.org" - Last Modified Year <= 2017 Do - Set Status to "Open" I believe the sqlite issue is a bug. For cases where posix_fallocate is supported by the operating system but returns EINVAL indicating that the filesystem does not support the operation we should just treat the call as advisory, and carry on. - if( err ) return SQLITE_IOERR_WRITE; + if( err!=EINVAL ) return SQLITE_IOERR_WRITE; Change in my WIP branch: https://github.com/emaste/freebsd/commit/77572f574f8c4aa2d9f4eaee (In reply to Ed Maste from comment #11) Twitter exchange with SQLite's author here: https://twitter.com/DRichardHipp/status/1002919969510821888 cy@ addressed sqlite issue in r342183 (sqlite3 update) |