On Fri, 27 Dec 1996, Christoph Lameter wrote:
> The following patch finally did the trick for me. I dont think this is
> clean. Linux seems to cache the inode information locally and so the field
>
> statbuf.st_nlink
>
> never reaches the value 2 which is required for the successful completion
> of the lock.
Aarrgghh!! In that case, it would appear that Linux NFS is not behaving
the same as NFS does on other systems, and is being particularly remiss
in its emulation of a local Unix filing system.
Be warned that your patch is disastrous. The whole point of checking the
number of links is to ensure that one and only one process has created
the lock file. Without that check the whole point of the algorithm is
lost; you are not getting any interlocking between processes.
Just grabbing at straws here, but have you tried fsync() or even sync()
before doing the stat, to see if that changes the behaviour?
--
Philip Hazel University Computing Service,
ph10@??? New Museums Site, Cambridge CB2 3QG,
P.Hazel@??? England. Phone: +44 1223 334714