Dunno. I've actually gone back to v3 everywhere I use nfs because v4 just seems too hard to make work properly with Linux. -Adam
Trevor Cordes trevor@tecnopolis.ca wrote:
A recent update (kernel, or something else) seems to have messed up file locking over NFSv4 on my system (yes, v4 allows for locking).
I use locking in perl scripts over NFS and it's always worked until now. I checked and lockd is running on the server still.
A test case is at the bottom of this email. The problem hits on line 13 where the open-for-write happens. It dies with "Input/output error".
The client's /v/l/messages says: [156474.509107] nfs4_reclaim_open_state: Lock reclaim failed!
If I run this on a local file, not over NFS, it works fine.
I'm using the lock functions as the sample code in the perl docs instructs. My goal is to lock a file, read it, do things, and write it out, all atomically. Mostly I want to protect against another instance of the same program doing the same thing at the same time and screwing up the file.
My NFS server is a an older linux (Fedora 14) than the client (Fedora 16), but the NFSv4 spec hasn't really changed in that span.
#!/usr/bin/perl -w # use Fcntl ':flock';
$file='/data/Tmp/locktest';
open(LOCK,$file) or die; flock(LOCK,LOCK_EX);
open(IN,$file) or die; # read from file close(IN);
open(ORI,">$file") or die $!; # dies here!!!!!!!!!!!!1 # write to file close(ORI);
flock(LOCK,LOCK_UN); _______________________________________________ Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
On 2012-03-30 Adam Thompson wrote:
Dunno. I've actually gone back to v3 everywhere I use nfs because v4 just seems too hard to make work properly with Linux.
v4's worked great for me for many years now. It's MUCH better to have v4 and locking support as things like OO(calc) won't run on files on NFS without locking. They just hang, hence why I switched. I want my FS to "just work" without "well it mostly works" hassles.
v4 is a major endeavor to setup. It's triply hard if you want to run a strict iptables on both client & server because it uses 30 million ports (seemingly) and by default they are random! But, you can specify ports for everything and eventually make it work. Probably the hardest part is figuring out from the crap/non-existent docs which daemons need to be run on client vs server. I still don't understand it all. But I have it working!