Hi Trond, Trond Myklebust wrote: > On Wed, 2008-01-02 at 10:55 +0100, Michael Kerrisk wrote: >> Hey Trond, >> >> Would you take a quick look at >> >> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453946 >> >> Do you have some insights on this? What should the man page say about >> current support of O_EXCL on NFS? >> >> Cheers, >> >> Michael > > Hi Michael, > > Timo is correct. O_EXCL has been supported for NFSv3 (and NFSv4) ever > since the 2.6 series kernels came out. > > However, please note that > * it is not supported for any 2.4.x kernels, since that would > require some VFS re-engineering that is not compatible with the > 'stable kernel' rules. > * As Timo states, the NFSv2 protocol cannot support O_EXCL > semantics.
Thanks. I've rewritten the text as shown below. I also have another question: is O_APPEND supported in NFSv3 or NFSv4? > I think the second point warrants keeping the link() workaround mention, > though, since people who are interested in writing completely portable > software may still find it useful. For instance, a lot of mail delivery > setups are still using the type of locking scheme described there. Yes, that makes sense. For man-pages-2.75, I rewrote the paragraph as shown here. Could you confirm that this is okay? O_EXCL is not supported on NFS file systems before NFSv3 or on Linux before kernel 2.6; it is sup- ported on Linux 2.6 and later, with NFSv3 or later. In environments where NFS O_EXCL support is not provided, programs that rely on it for per- forming locking tasks will contain a race condi- tion. Portable programs that want to perform atomic file locking using a lockfile, and need to avoid reliance on NFS support for O_EXCL, can cre- ate a unique file on the same file system (e.g., incorporating hostname and PID), and use link(2) to make a link to the lockfile. If link(2) returns 0, the lock is successful. Otherwise, use stat(2) on the unique file to check if its link count has increased to 2, in which case the lock is also successful. Cheers, Michael -- Michael Kerrisk Maintainer of the Linux man-pages project http://www.kernel.org/doc/man-pages/ Want to report a man-pages bug? Look here: http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]