[OpenAFS-devel] flock Input/output error

Simon Wilkinson sxw@inf.ed.ac.uk
Fri, 13 Aug 2010 16:02:11 +0100


On 13 Aug 2010, at 14:18, Derek Atkins wrote:
>=20
> So the questions to you would be:  What is AFSLock and what is
> KernelLock?

I guess you haven't read the earlier posts. I'd encourage you to read =
the whole thread - there's a lot more information there. But, to =
summarise, these aren't process locks that we're talking about, but file =
locking enrolments. AFSLock is the AFS file lock held, and administered =
by, the file server.  KernelLock is the enrolment of that file lock in =
the Linux kernel's file lock tracking scheme, so that we can handle byte =
range locks.

>  And what are the relationships between them?  Clearly they
> are not quite independent.

No - they are deeply dependent

*) If the file server grants you a lock, then you should register that =
lock with the kernel
*) If you release a lock on the fileserver, then you should free that =
lock in the kernel, too.

>  You ask "what if ReleaseAFSLock fails?"  Can you fail to release the =
AFS lock?

Yes. The fileserver can fail the ReleaseAFSLock RPC for a number of =
reasons, or you could actually fail to contact the file server. Under =
those circumstances, the client should assume that the file is still =
locked, and return a failure to the user. (Of course, there is a whole =
rats nest here about files that are being released through a call to =
close, and applications which don't check that close succeeds)

>  If so, what would it MEAN to fail to release the AFS Lock?

In many, but not all, situations it means that the client still holds a =
lock on that file.

> If you're really worried about failing to release the AFSLock, then =
what about if you can only have the AFSLock if you have the KernelLock?

The KerneLock is local to a particular client, the AFSLock is global. So =
there's no way of enforcing this for a particular machine.

Cheers,

Simon.