From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12770 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: posix_fallocate() fails on some machines Date: Thu, 26 Apr 2018 16:52:37 -0400 Message-ID: <20180426205237.GM3094@brightrain.aerifal.cx> References: <20180426200825.GL3094@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1524775845 17983 195.159.176.226 (26 Apr 2018 20:50:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 26 Apr 2018 20:50:45 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) Cc: musl To: John Mudd Original-X-From: musl-return-12786-gllmg-musl=m.gmane.org@lists.openwall.com Thu Apr 26 22:50:41 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fBnqj-0004ZR-6o for gllmg-musl@m.gmane.org; Thu, 26 Apr 2018 22:50:41 +0200 Original-Received: (qmail 24487 invoked by uid 550); 26 Apr 2018 20:52:50 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 24469 invoked from network); 26 Apr 2018 20:52:49 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12770 Archived-At: On Thu, Apr 26, 2018 at 04:21:07PM -0400, John Mudd wrote: > Thanks. It seems my mistake was to build on a VM with ext4 file system. My > intention was for the build VM to be the lowest common denominator of my > production PCs. That's why I use 32-bit. I'll change to ext3 on the build > VM. ext3 (and even ext2 I think) should support it fine. The problem is wacky stuff like btrfs or xfs or whatnot (not sure which one(s)). Rich > On Thu, Apr 26, 2018 at 4:08 PM, Rich Felker wrote: > > > On Thu, Apr 26, 2018 at 03:54:19PM -0400, John Mudd wrote: > > > I built a 32-bit dynamically linked Postgres using musl but I can't run > > on > > > some machines because posix_fallocate() returns 95, "not supported". > > > > > > Here's a sample program that reproduces the issue even when compiled > > > statically. Any suggestions? > > > > > > # Build a 32-bit static executable. Works. > > > $ cat test_posix_fallocate.c > > > #include > > > #include > > > int main() { > > > int fd = open("foo", O_RDWR|O_CREAT, 0666); > > > if (fd < 0) return 1; > > > printf("posix_fallocate() returned %d\n", posix_fallocate(fd, 0, > > > 400000)); > > > } > > > $ > > > $ uname -mrs > > > Linux 4.4.0-116-generic i686 > > > $ musl-gcc -static -o test_posix_fallocate test_posix_fallocate.c > > > $ test_posix_fallocate > > > posix_fallocate() returned 0 > > > $ > > > > > > # Copy it to an older OS. Fails. > > > $ uname -mrs > > > Linux 2.6.32-358.14.1.el6.x86_64 x86_64 > > > $ test_posix_fallocate > > > posix_fallocate() returned 95 > > > $ > > > > This is a bug in postgresql. It must accept that some underlying > > filesystems do not support posix_fallocate. The reason it doesn't is > > that glibc implements a buggy and dangerous fallback when it's not > > supported, resolved WONTFIX: > > > > https://sourceware.org/bugzilla/show_bug.cgi?id=6865 > > > > Simply patch postgresql not to consider this a fatal error, or use a > > filesystem where posix_fallocate is supported (e.g. ext3/4). > > > > Rich > >