[Ext2-devel] Re: Linux performance bug: fsync() for files with zero links

Erik Mouw erik at harddisk-recovery.com
Tue Feb 28 16:30:17 UTC 2006

On Tue, Feb 28, 2006 at 08:50:53PM +0500, Victor Porton wrote:
> On 28-Feb-2006 Erik Mouw wrote:
> > It even makes sense on a single machine with multiple programs still
> > accessing the same file. You want fsync() and fdatasync() to work
> > regardless of the amount of links. Not doing so could subtly break
> > programs. For example:
> Erik, what you said above is wrong.
> There are no need to sync this file to disk (except of when we are out of
> memory). It is enough to sync the buffers in MEMORY.
> From man write(2):
>        write  writes  up  to  count  bytes  to the file referenced by the file
>        descriptor fd from the buffer starting at buf.  POSIX requires  that  a
>        read()  which  can  be  proved  to  occur  after a write() has returned
>        returns the new data.  Note that not all file systems  are  POSIX  con-
>        forming.

AFAIK that's read() from the same process, not read() from another
process. Otherwise there would be no need for fsync()/fdatasync().

But look at my example. tail(1) uses fstat64() to figure out if
/var/log/messages changed. Your proposal for a patch will break that.
Again: the number of links of an inode is not a reason to break
established semantics.


+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands

More information about the Ext3-users mailing list