Re: fsync in glib/gio



On 03/13/2009 05:16 PM, Alexander Larsson wrote:
On Fri, 2009-03-13 at 15:05 -0600, Federico Mena Quintero wrote:
On Fri, 2009-03-13 at 09:15 -0400, Morten Welinder wrote:

F*** "POSIX allows this"!  A program that does open-write-close-
rename should not be left with an empty file in case something
goes wrong.  The old file, or the new file.  Anything else is insane
and by extension the kernel developers and their ancestors.
100% agreed.

Has anyone actually debugged why this happens?  The kernel must surely
ensure that even if it reorders data/metadata requests, it will do so in
sensible ways only, doesn't it?

Its well explained in the various discussions about this. Essentially,
the metadata for the rename is written to disk, but the data in the file
is not (yet, due to delayed allocation) and then the system crashes. On
fsck we discover the file is broken (no data) and set the file size to
0.

That's clearly a broken filesystem (screw standards. If it doesn't do what users expect, it's broken). Why work around it in gio? Have the filesystem guys "fix" it for whatever that means.

All we need the few major distros handling it properly.

behdad


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]