Re: fsync, ext2 on Linux

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: fsync, ext2 on Linux
Date: 2004-10-31 15:31:24
Message-ID: 4185054C.9050500@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.
>
>

The notes say this:

When an ext2 file system is mounted with the sync option,
directory
entries are also implicitly synced by fsync.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-10-31 15:38:43 Re: Problems with pgxs
Previous Message Tom Lane 2004-10-31 15:15:01 Re: fsync, ext2 on Linux