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

From: Simon Kirby
Date: Sun Jun 06 2004 - 13:56:05 EST


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-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/