[OpenAFS] Is locking (flock) on OpenAFS reliable?

Matthias Gerstner matthias.gerstner@esolutions.de
Mon, 4 Jul 2011 13:06:52 +0200


Hello,

I wonder what the status of using flock calls (or the flock utility)
with OpenAFS is. Generally it seems to work to synchronize different
machines with each other using flock on OpenAFS. But in practice I
encountered inconsistencies.

When doing research about this topic I found no real realiable
information what OpenAFS does intend to provide in this area. I know
that byte-range locking is not supported between multiple machines. But
that doesn't matter for me.

So what I encounter particularly is the following:

I'm using flock to safely get a copy of a small directory tree on AFS. A
central machine in the network updates that data regularly so I want to
be able to get a consistent copy from other machines. This works well
for most of the time but every now and then I get the following error:

/usr/bin/flock: 3: Input/output error

Also when testing flock interactively between different machines it
seems that sometimes it works as expected and then at other times more
than one machine obtains the lock at the same time.

No obvious errors can be found in client kernel logs or server logs. I
primarily use OpenAFS on Gentoo Linux currently at version 1.4.14. But I
experienced the problems for a long time already not only with this
specific version.

Another question I have is whether locking should also work from Windows
OpenAFS clients. I'm using cygwin on Windows7 and try using flock there
on OpenAFS files and it seems to do something but I'm not sure if it's
doing the right thing.

I'd be happy to hear any advice on this.

Best regards,

Matthias

-- 
Matthias Gerstner, Dipl.-Wirtsch.-Inf. (FH), Senior Software Engineer
e.solutions GmbH

Am Wolfsmantel 46, 91058 Erlangen, Germany

Registered Office:
Pascalstr. 5, 85057 Ingolstadt, Germany

Phone +49-8458-3332-672, mailto:Matthias.Gerstner@esolutions.de
Fax +49-8458-3332-20672

e.solutions GmbH
Managing Directors Uwe Reder, Dr. Riclef Schmidt-Clausen
Register Court Ingolstadt HRB 5221