[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua and the fsync problem with ext4
- From: Matthew Wild <mwild1@...>
- Date: Mon, 16 Mar 2009 09:33:23 +0000
On Mon, Mar 16, 2009 at 1:55 AM, William Bubel <firstname.lastname@example.org> wrote:
> I've been seeing a lot of talk on the intertubes lately about how most
> application developers have been doing files the wrong way when it comes
> to the atomicity of their file transactions. I was curious if there
> is a Lua way to do this yet. All I've seen in the ref manual is
> file:flush, which as of 5.1.3's source looks like a wrapper for fflush,
> and I believe that would only get the file out of the internal buffers
> and into the operating system's delayed allocation buffers.
Note that fflush() only flushes the user space buffers provided by the
C library. To ensure that the data is physically stored on disk the
kernel buffers must be flushed too, for example, with sync(2) or
Apparently so, I wasn't aware of this, so thanks for pointing it out.
Have some code to fix :)
> For what its worth, the Python people seem to believe that fflush is the
> end of our responsibility as application developers.
The ext4 people claim that application developers have been doing the
Wrong Thing for some time. Fair enough, I'm happy to fix it.
Unfortunately it seems that fsync() on ext3 isn't great :(
Problem 2 is that fsync() doesn't appear to be defined by ANSI C.
So it looks like we need an fsync() binding and a configuration option
in applications as to whether we should use it. In other words, not a
Lua interpreter issue per se.