Re: fsync in glib/gio



On Fri, 2009-03-13 at 12:18 +0100, Sven Neumann wrote:
> Hi,
> 
> On Fri, 2009-03-13 at 08:38 +0100, Alexander Larsson wrote:
> 
> > If you want to you can make all i/o sync by mounting it as such. But
> > thats of course really slow. Generally the gio file write operations are
> > used for saving files, and people sort of expect that when save returns
> > the file is ok on disk. 
> 
> Do they?? Doing file I/O asynchronously is a feature, in particular for
> laptop users. It improves I/O performance and it saves power. Of course
> it's a risk and may result in data loss under certain rare
> circumstances. But it's a risk that people are willing to take. Please
> do not ruin this by implicitly enforcing fsync.

Its clear from the ubuntu bug report that this is not "a risk that
people are willing to take". Everything mounts async by default, and
almost nobody is aware of this risk. Its especially bad that it risks
not only the newly written data, but the previous version of the data
too.

> IMO the correct way to deal with this would be to add a flag that allows
> application developers that deal with important data to request
> synchronous I/O in he gio file saving code and in g_file_set_contents().
> So instead of defaulting to this and adding a G_FILE_CREATE_ASYNC_WRITE
> flag, we could keep the default behavior and add
> G_FILE_CREATE_SYNC_WRITE.

I don't agree. I think we should be robust by default and allow concious
people to specify unsafe behaviour when the conditions are such that it
makes sense. Anything else is a disservice to peoples data.





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