Howdy- I have a quick question which is marginally connected to NetApp-land. I was wondering if anyone had a tool for spoofing the RPC call(s) necessary to tell an NFS server to let go of a lock. Barring that, any pointers (besides OS source, which is my next stop) to documentation of the necessary dance would also be appreciated.
I'd like to deal with the cases where a server thinks a file is locked, but the client has forgotten all about it (in a more graceful way than changing the file's inode by moving the data to another new file and then back again).
I'm guessing the folks in NetApp engineering must have a lock make/break tool handy for their regression testing, hence my request here. I'd also be interested in knowing if there are any magic OnTap commands for showing all of the exisiting locks that the box is holding.
Thanks!
Respectfully, David N. Blank-Edelman Director of Technology College of Computer Science Northeastern University
I was wondering if anyone had a tool for spoofing the RPC call(s) necessary to tell an NFS server to let go of a lock.
I don't know of any way to selectively release locks that have been "forgotton" by a client, but one of our support people once developed a procedure which can be used to rid yourself of *all* locks that are associated with a particular client. It goes like this:
1. Kill statd on the client. 2. With "lockd" running, lock a file over NFS. 3. Kill lockd on the client. 4. Restart statd. Statd will send a STATMON packet to the filer that causes the filer to blow away all of the locks for that client. 5. Restart lockd.
It is, of course, very easy to write a little C program that creates locks. The below PERL script can also be used.
Keith ---- #!/usr/local/bin/perl5 # Check the input @ARGV for errors. if(!defined($ARGV[0]) || ($ARGV[0]=~/[^0-9]/) && defined($ARGV[1])) { die "Usage: lock <seconds> <filename>\n"; }
# Get the filename from @ARGV if(!defined($ARGV[1])) { $filename=$ARGV[0]; } else { $filename=$ARGV[1]; $wait_time=$ARGV[0]; }
$LOCK_EX=2; $LOCK_UN=8;
open(F, ">>$filename") || die "$filename: $!\n"; flock(F, $LOCK_EX) || die "$!\n";
if (defined($wait_time)) { sleep($wait_time); }
flock(F, $LOCK_UN) || die "$!\n";