Comment 84 for bug 317781

Revision history for this message
Theodore Ts'o (tytso) wrote :

@Brian,

One other thought... emacs (and all other competently implemented editors) will use fsync() and *should* use fsync because for networked filesystems, fsync() may be the only way that the editor will know whether or not a file will be written to stable storage. For example, if AFS returns a quota error, or the NFS server has disappeared because of a network outage, the OS may not try to contact the fileserver when calling write(2), and perhaps not even when close(2) is called. The only way to be certain of receiving error return codes from file systems is to call fsync() on the file, before it is closed. Given the semantics of fsync(), that will wake up the hard drive, and there's not much that can be done about that.

If you really don't like that, not saving your buffers will have the same net effect, and have the same downside risks (namely, that after a crash, you'll lose data that hasn't been safely written to disk). Of course, I use carefully selected hardware (an X61s with integrated graphics) and I've but rarely had crashes that would have lost me data --- and I can count the times when I've lost data due to delayed allocation on the fingers on one hand --- but again, I use the "sync" command before I do somethng which I think might trigger a kernel crash, and this is larlgely never been a problem with me.