Comment 125 for bug 317781

Revision history for this message
Kai Krakow (hurikhan77) wrote :

> THIS IS NOT A BUG!

I would consider it a bug. As far as I understood the problem is that flushing to the filesystem does not occur in correct order. Metadata should be flushed after data has been flushed to ensure transactional integrity. But exactly this is what Ext4 currently does not. Hence it truncates the files instead of leaving it being unsure about the content.

On the other hand: Surely many apps need fixing. But you can imagine what happens to fs performance if every application does fsyncs after every write or before every close. Performance would suffer badly. fsync is needed for critical phases like writing important/central configuration files, database stuff etc. Both sides need fixing. In the spirit of posix of course the current behaviour is perfectly okay as far as I understood. But it's not very wise to do it that way.

I'd prefer that Ext4 leaves my files with the old content instead of simply truncating them because it cannot ensure integrity after a crash if the file's data has only been partly flushed.

Other file systems handle this case better - e.g. even NTFS. Problems as these just feed the trolls - so let's fix it.

In my eyes close() should ensure transactional integrity between write() and close(). fsync() should ensure logical integrity between writes or updating of multiple files related to each other. This may not be technically currect but this is how I understand the tools given by the filesystem API. In reality it may be more complicated.

PS: I intentionally chose to compare to a non-POSIX fs...