Mandatory File Locking In Nfs V3 : How To?
I have a central file say, "central.txt ", mounted on an NFS v3 server. Now I have a minimum of 20 processes wanting to update the "central.txt" file at the same time. To ensure that the entries of this "central.txt" is consistent, I should lock the file before I update it and unlock the file after i update it.
I read is some where that NFS v3 supports only advisory locking. I need a mandatory locking system here. Is there any way I can issue a "mandatory lock" on the central.txt file?
I tried the following without any help.
**NOTE** : I'm using perl to write my script (that uses the central.txt file). It is this script that I run concurrently.
1. flock : doesn't work
2. system ("lockfile -l 10 -s 8 filename); : doesn't work
3. fcntl : doesn't work
4. File::NFSLock : doesn't work
Could any one tell me how to obtain a mandatory lock on a file mounted in NFS v3 and also how to trap any error while locking the file?
Thanks