On Fri, 30 Mar 2018 15:12:31 +0200 Rhialto <rhia...@falu.nl> wrote: > I have just been pointed at a postgresql mailing list discussion > about a scenario where a program has written data to a file > descriptor, calls fsync(), there is an I/O error in writing the data > out, and the program re-tries the fsync() until it returns success.
Hello, I don't know how NetBSD kernel handles this, but I think this program's design may be flawed. When writing to a single file, any I/O error means some data didn't make it, but which data and how much of it, is really up to the implementation. Not sure it is safe to assume anything at this point. A better design would be to write some data, call fsync, and if any errors occur, then retry I/O, rather than just fsync. This is more complicated with small random I/O.