在 Linux 2.6 内核和 NFSv3 中何时open("fname", O_CREAT|O_EXCL)
生效?当前的规范open(2)
系统调用文档(http://www.kernel.org/doc/man-pages/online/pages/man2/open.2.html)说一切都很好:
- O_EXCL
- ...
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel
2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will
contain a race condition. Portable programs that want to perform
atomic file locking using a lockfile, and need to avoid reliance on NFS
support for O_EXCL, can ...
这看起来好像所有 2.6 内核都可以,但是手册页更改日志(ca 后期内核 2.6.23)在 2.6.0 上线四年后开始显示有效性,并且网络上充斥着董事会用户在去年谴责这种使用或两个。我想在 RHEL 5 (2.6.18) 系统上使用这个设置,但是当它真正变得安全时我无法确定。有人有明确的答案吗?