Re: clone() <-> getpid() bug in 2.6?

Simon Kirby
2004-06-06T18:53:30Z

On Sun, Jun 06, 2004 at 09:57:20AM -0700, Linus Torvalds wrote:

> /* Write the pid into the lockfile, fsync it */
> write(fd, name + 9, len - 9);
> fsync(fd);

Unrelated to this discussion -- and there is a close() missing -- but is
there any reason for fsync() to be there? I've seen this often before,
but I've never understood why it would be necessary to force the data to
disk, especially when it will likely be removed later before it would
have otherwise been written to disk. Shouldn't the lock file behave
properly without fsync(), even across NFS, and even across all OSes?

Simon-