Re: XFS: how to NOT null files on fsck?

From: Helge Hafting
Date: Sun Jul 11 2004 - 16:53:08 EST


On Sat, Jul 10, 2004 at 11:24:53PM +0200, Bernd Eckenfels wrote:
> In article <20040710184357.GA5014@xxxxxxxxxxxxxxxxxxxxx> you wrote:
> > No, that's not the case. Normally when files are written the data
> > isn't not flushed immediately, it sits in memory (the page-cache) for
> > some (usually) small amount of time.
>
> Does that mean, that closing a tempfile and then renaming the file is not
> a reliable way to tell, that the data is persited? I usually use a atomic
> rename to have a point from which on I can tell if the data is complete
> and persisted.
>
> I thought close() has fsync() semantics?
>
No, it doesn't.

close() will flush the C library buffer. That means the data
moves from theose buffers to the pagacache. The program crashing
after that will have no effect on the file. It can still
be lost if the _kernel_ crashes though.
If you want the pagecache flushed to disk, use fsync (or sync)

Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/