Skip site navigation (1) Skip section navigation (2)

Re: fsync, ext2 on Linux

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: fsync, ext2 on Linux
Date: 2004-10-31 18:19:35
Message-ID: Pine.OSF.4.61.0410312005580.256140@kosh.hut.fi (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sun, 31 Oct 2004, Tom Lane wrote:

> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
>> The Linux [ext2] fsync man page says:
>> "It does not necessarily ensure that the entry in the directory
>> containing the file has also reached disk. For that an explicit fsync on
>> the file descriptor of the directory is also needed."
>
> This seems so broken as to defy belief.  A process creating a file
> doesn't normally *have* a file descriptor for the parent directory,
> and I don't think the concept of an FD for a directory is even
> portable (opendir() certainly doesn't return an FD).  One might also
> ask if we are expected to fsync everything up to the root in order
> to be sure that the file remains accessible, and how exactly we should
> do that on directories we don't have write access for.

I agree on the brokeness. Linux is the only OS that's broken that I know 
of. Therefore it doesn't really matter if the fix is portable or not, we 
would only do it on Linux anyway.

Surely it's not necessary to crawl up to the root. Just fsync the 
parent of every new file and directory.

> In general we expect the filesystem to take care of its own metadata.
> Run ext3 in journaling mode, or something like that.

I normally run reiserfs, I set up the ext2 filesystem just to test it.

> (It occurs to me that the admin guide really ought to have a few words
> about recommended and non-recommended filesystems ...)

That's the least we can do. I wonder if we could check the filesystem at 
runtime and issue a warning if it's not in the list of recommended 
filesystems.

- Heikki

In response to

pgsql-hackers by date

Next:From: Roland VolkmannDate: 2004-10-31 20:08:31
Subject: Charset WIN1252
Previous:From: Heikki LinnakangasDate: 2004-10-31 18:02:09
Subject: Re: fsync, ext2 on Linux

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group