From owner-freebsd-questions@FreeBSD.ORG Wed Oct 27 00:53:51 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22DC3106564A for ; Wed, 27 Oct 2010 00:53:51 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (ns2.r-bonomi.com [204.87.227.129]) by mx1.freebsd.org (Postfix) with ESMTP id EBBB28FC08 for ; Wed, 27 Oct 2010 00:53:50 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.3/rdb1) id o9R0pmwR005010; Tue, 26 Oct 2010 19:51:48 -0500 (CDT) Date: Tue, 26 Oct 2010 19:51:48 -0500 (CDT) From: Robert Bonomi Message-ID: <201010270051.o9R0pmwR005010@mail.r-bonomi.com> To: cswiger@mac.com, scrappy@hub.org Cc: freebsd-questions@freebsd.org Subject: Re: fsync: Linux vs FreeBSD X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 00:53:51 -0000 On Oct 26, 2010, at 11:33 AM, Marc G. Fournier wrote: > Someone recently posted on one of the PostgreSQL Blogs concerning fsync on Linux/Windows/Mac OS X, but failed to make any comments on any of the BSDs ... the post has to do with how fsync works on the various OSs, and am curious as to whether or not this is something that also afflicts us: > > http://rhaas.blogspot.com/2010/10/wal-reliability.html > >> From reading our man page, I see no warnings similar to what the other OSs > have, specifically: > > Mac OS X: For applications that require tighter guarantees about the > integrity of their data, Mac OS X provides the F_FULLFSYNC fcntl > > Linux: If the underlying hard disk has write caching enabled, then the > data may not really be on permanent storage when fsync() / > fdatasync() return. > > So, do we hide the fact, or are, in fact, not afflicted by this? > > It has -always- been the case with the Berkeley FFS that, by default, not all operations are sychronous, and that sync()/fsync() just 'schedule' the flush operation, w/o waiting for it to complete. This is precisely why the "tradiitional" emergency shutdown was: "sync sync halt {or haltsys"} " There is a mount option that forces all I/O on the device to be synchronous, but the performance penalty is _massive_.