Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Mandatory File Locking In Nfs V3 : How To?

446205Jun 23 2005
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 21 2005
Added on Jun 23 2005
0 comments
764 views