Re: Fwd: Is the fsync() fake on FreeBSD6.1? - Mailing list pgsql-hackers

From Andrew - Supernews
Subject Re: Fwd: Is the fsync() fake on FreeBSD6.1?
Date
Msg-id slrneh8gp1.2ea3.andrew+nonews@atlantis.supernews.net
Whole thread Raw
In response to Fwd: Is the fsync() fake on FreeBSD6.1?  (Jim Nasby <jim@nasby.net>)
Responses Re: Fwd: Is the fsync() fake on FreeBSD6.1?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Fwd: Is the fsync() fake on FreeBSD6.1?  (Ron Mayer <rm_pg@cheapcomplexdevices.com>)
List pgsql-hackers
On 2006-09-22, Jim Nasby <jim@nasby.net> wrote:
> I thought folks might be interested in this... note in particular the  
> comment about linux.

I don't believe that either person in that discussion knows what they are
really talking about.

fsync() on FreeBSD does, as is required, force any modified data for the
file, plus any metadata, plus any modifications to any parent directories,
to the underlying disk device and waits for that device to report the
write as complete.

Whether the underlying device lies about the write completion is another
matter. All current SCSI disks have WCE enabled by default, which means
that they will lie about write completion if FUA was not set in the
request, which FreeBSD never sets. (It's not possible to get correct
results by having fsync() somehow selectively set FUA, because that would
leave previously-completed requests in the cache.)

WCE can be disabled on either a temporary or permanent basis by changing
the appropriate modepage. It's possible that Linux does this automatically,
or sets FUA on all writes, though that would surprise me considerably;
however I disclaim any knowledge of Linux internals.

On FreeBSD, this command will disable WCE permanently on a SCSI drive:

echo 'WCE: 0' | camcontrol modepage daXX -m 8 -P3 -e

(use -P0 to disable it only temporarily, or you can use just the second of
those commands alone to interactively edit the mode page)

-- 
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: Release Notes: Major Changes in 8.2
Next
From: "Merlin Moncure"
Date:
Subject: Re: advisory locks and permissions