Re: NFS problems with Linux-2.4

From: jlnance@unity.ncsu.edu
Date: Sun May 18 2003 - 19:53:16 EST


On Sun, May 18, 2003 at 05:00:24PM +0200, Trond Myklebust wrote:
>
> Sorry. stat doesn't obey close-to-open. It relies on standard
> attribute caching. close-to-open means "open()" (and only "open()")
> checks data cache consistency...

Trond,
    Thanks for the info. Here is a section of the man page for open.
Is the information it gives correct wrt using link & stat?

       O_EXCL When used with O_CREAT, if the file already exists
              it is an error and the open will fail. In this con
              text, a symbolic link exists, regardless of where
              its points to. O_EXCL is broken on NFS file sys
              tems, programs which rely on it for performing
              locking tasks will contain a race condition. The
              solution for performing atomic file locking using a
              lockfile is to create a unique file on the same fs
              (e.g., incorporating hostname and pid), use link(2)
              to make a link to the lockfile. If link() 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 suc
              cessful.

Thanks,

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



This archive was generated by hypermail 2b29 : Fri May 23 2003 - 22:00:32 EST